mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-29 08:41:15 -03:00
Always treat brace at command start as compound statement
For backwards compatibility, fish does not treat "{echo,hello}" as a compound
statement but as brace expansion (effectively "echo hello"). We interpret
"{X...}" as compound statement only if X is whitespace or ';' (which is an
interesting solution).
A brace expansion at the very start of a command
is usually pointless (space separation is shorter).
The exception are cases where the command name and the first few arguments
share a suffix.
$ {,1,2,3,4}echo
1echo 2echo 3echo 4echo
Not sure if anyone uses anything like that. Perhaps we want to trade
compatibility for simplicity. I don't have a strong opinion on this.
Always parse the opening brace as first character of a command token as
compound statement.
Brace expansion can still be used with a trick like: «''{echo,foo}»
Closes #11477
This commit is contained in:
@@ -917,6 +917,12 @@ If there is nothing between a brace and a comma or two commas, it's interpreted
|
||||
|
||||
To use a "," as an element, :ref:`quote <quotes>` or :ref:`escape <escapes>` it.
|
||||
|
||||
The very first character of a command token is never interpreted as expanding brace, because it's the beginning of a :ref:`compound statement <cmd-begin>`::
|
||||
|
||||
> {echo hello, && echo world}
|
||||
hello,
|
||||
world
|
||||
|
||||
.. _cartesian-product:
|
||||
|
||||
Combining lists
|
||||
|
||||
Reference in New Issue
Block a user