STRING-JOIN0(1) fish-shell STRING-JOIN0(1)

# [NAME](#NAME)

string-join0 - join strings with zero bytes

# [SYNOPSIS](#SYNOPSIS)

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

# [DESCRIPTION](#DESCRIPTION)

Joins its *STRING* arguments into a single string separated by *SEP* (for **string join**) or by the zero [byte (NUL)](/man/os/fish/byte.NUL) (for **string join0**). Exit status: 0 if at least one join was performed, or 1 otherwise.

[**-n**, **--no-empty**](#n)

Exclude empty strings from consideration (e.g. **string join -n + a b "" c** would expand to **a+b+c** not **a+b++c**).

[**-q**, **--quiet**](#q)

Do not print the strings, only set the exit status as described above.

**WARNING**: Insert a **--** before positional arguments to prevent them from being interpreted as flags. Otherwise, any strings starting with **-** will be treated as flag arguments, meaning they will most likely result in the command failing. This is also true if you specify a variable which expands to such a string instead of a literal string. If you don't need to append flag arguments at the end of the command, just always use **--** to avoid unwelcome surprises.

**string join0** adds a trailing NUL. This is most useful in conjunction with tools that accept NUL-delimited input, such as **sort -z**.

Because Unix uses NUL as the string terminator, passing the output of **string join0** as an *argument* to a command (via a command substitution &lt;#expand-command-substitution&gt;) won't actually work. fish will pass the correct bytes along, but the command won't be able to tell where the argument ends. This is a limitation of Unix' argument passing.

# [EXAMPLES](#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
```

# [Copyright](#Copyright)

fish-shell developers

October 10, 2026 4.9

---

Document: string-join0(1) from fish 4.9.3-r1 (Chainguard OS)
Source: https://github.com/fish-shell/fish-shell
