From d00576c9ea440beac7dca59675aaeedec80fec20 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 4 May 2021 14:12:44 +0200 Subject: [PATCH] docs: More on join0 --- doc_src/cmds/string-join.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc_src/cmds/string-join.rst b/doc_src/cmds/string-join.rst index 267c56992..28207c0cc 100644 --- a/doc_src/cmds/string-join.rst +++ b/doc_src/cmds/string-join.rst @@ -22,6 +22,8 @@ Description ``string join0`` joins its STRING arguments into a single string separated by the zero byte (NUL), and adds a trailing NUL. This is most useful in conjunction with tools that accept NUL-delimited input, such as ``sort -z``. Exit status: 0 if at least one join was performed, or 1 otherwise. +Because Unix uses NUL as the string terminator, passing the output of ``string join0`` as an *argument* to a command (via a :ref:`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. This is a limitation of Unix' argument passing. + .. END DESCRIPTION Examples @@ -34,4 +36,10 @@ 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 .. END EXAMPLES