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 "" cwould expand toa+b+cand nota+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 π
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