From 822ee634c46ca17f44a6dbf74a7d87664cc316e2 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 6 Jun 2017 22:05:23 +0200 Subject: [PATCH] docs: Mention command-substitution splitting in tutorial See #4097. --- doc_src/tutorial.hdr | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc_src/tutorial.hdr b/doc_src/tutorial.hdr index 034a5035b..bc4df3bd7 100644 --- a/doc_src/tutorial.hdr +++ b/doc_src/tutorial.hdr @@ -391,6 +391,17 @@ Command substitutions are not expanded within quotes. Instead, you can temporari testing_1360099791.txt \endfish +Unlike other shells, fish does not split command substitutions on any whitespace (like spaces or tabs), only newlines. This can be an issue with commands like `pkg-config` that print what is meant to be multiple arguments on a single line. To split it on spaces too, use `string split`. + +\fish{cli-dark} +>_ printf '%s\n' (pkg-config --libs gio-2.0) +-lgio-2.0 -lgobject-2.0 -lglib-2.0 +>_ printf '%s\n' (pkg-config --libs gio-2.0 | string split " ") +-lgio-2.0 +-lgobject-2.0 +-lglib-2.0 +\endfish + \section tut_combiners Combiners (And, Or, Not)