STRING-JOIN(1)

✨ STRING-JOIN πŸ’… β€” the fish-shell manual, page 1 of (1)

okay so bestie, buckle up, because this is STRING-JOIN(1), aka the little fish function that smooshes your strings together with a separator and absolutely ate πŸ’–


πŸŽ€ NAME πŸŽ€

string-join β€” join strings with a delimiter. that's it. that's the whole vibe.


πŸ¦‹ SYNOPSIS πŸ¦‹

string join [-q | --quiet] [-n | --no-empty] [--] SEP [STRING ...]
string join0 [-q | --quiet] [-n | --no-empty] [--] [STRING ...]

🌸 DESCRIPTION 🌸

So what it does: it takes your STRING arguments and joins them into one single string, separated by SEP β€” that's for string join β€” or by the zero byte (NUL) when you're using string join0. iykyk 😌

Exit status: 0 if at least one join was performed, or 1 otherwise. simple as that, no cap.


πŸ’… OPTIONS πŸ’…

  • -n, --no-empty β€” leaves empty strings out of the party. like, string join -n + a b "" c would expand to a+b+c and not a+b++c. the "" gets ghosted πŸ‘»
  • -q, --quiet β€” doesn't print the strings at all, it just sets the exit status the way we described above. main character energy: shows up, does the job, says nothing πŸ”₯
⚠️ WARNING, and I mean this fr fr: put a -- before your positional arguments so they don't get read as flags. otherwise any string starting with - gets treated as a flag argument, which means your command will most likely just fail 😭 and this hits you even if you're passing a variable that expands to a string like that instead of a literal string. so honestly? if you don't need to append flag arguments at the end of the command, just always use -- and dodge the unwelcome surprises entirely. self-care πŸ’–

string join0 adds a trailing NUL. this is most useful when you're teaming up with tools that eat NUL-delimited input, like sort -z. obsessed with a collab 🀝

Because Unix uses NUL as the string terminator, passing the output of string join0 as an argument to a command (via a command substitution) won't actually work. 🫠 fish will pass the correct bytes along, but the command won't be able to tell where the argument ends. that's just a limitation of Unix' argument passing β€” not us, not fish, not your fault. it's giving "blame the ancestors" πŸ’€


🌈 EXAMPLES 🌈

>_ seq 3 | string join ...
1...2...3
# Give a list of NUL-separated filenames to du (this is a GNU extension)
>_ string join0 file1 file2 file\nwith\nmultiple\nlines | du --files0-from=-
# Just put the strings together without a separator
>_ string join '' a b c
abc
>_ set -l markdown_list '- first' '- second' '- third'
# Strings with leading hyphens (also in variable expansions) are interpreted as flag arguments by default.
>_ string join \n $markdown_list
string join: - first: unknown option
# Use '--' to prevent this.
>_ string join -- \n $markdown_list
- first
- second
- third

see that last one? that's the -- saving your whole life. learn it, love it, use it ⭐


Copyright: fish-shell developers 🐟


okay that's the page!! πŸ’œ brought to you by fish-shell developers, version 4.9, dated Sep 08, 2026 β€” go forth and join your strings responsibly, bestie 🫢✨

πŸ“¦ where this page comes from
  • arch rolling: fish 4.9.3-1 Β· GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms