mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
docs: Rename cross to cartesian product, clarify
This commit is contained in:
parent
f86ee20579
commit
b13ee9da2a
1 changed files with 9 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue