diff options
-rw-r--r-- | doc_src/tutorial.hdr | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/doc_src/tutorial.hdr b/doc_src/tutorial.hdr index 829e13e9..6ecd13c6 100644 --- a/doc_src/tutorial.hdr +++ b/doc_src/tutorial.hdr @@ -348,14 +348,21 @@ You can iterate over a list (or a slice) with a for loop: <outp>entry: /usr/local/bin</outp> \endfish -If you append a list to a string (or to a list), it will build the cross-product: +Lists adjacent to other lists or strings are expanded as cartesian products unless quoted (see <a href="index.html#expand-variable">Variable expansion</a>): + \fish{cli-dark} >_ set -l a 1 2 3 >_ set -l 1 a b c >_ echo $a$1 -<outp>1a 2a 3a 1b 2b 3b 1c 2c 3c +<outp>1a 2a 3a 1b 2b 3b 1c 2c 3c</outp> +>_ echo $a" banana" +<outp>1 banana 2 banana 3 banana</outp> +>_ echo "$a banana" +<outp>1 2 3 banana</outp> \endfish +This is similar to <a href="index.html#expand-brace">Brace expansion</a>. + \section tut_command_substitutions Command Substitutions Command substitutions use the output of one command as an argument to another. Unlike other shells, `fish` does not use backticks ` for command substitutions. Instead, it uses parentheses: |