[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
parsing command substitution inside parameter expansion in interactive s
From: |
Grisha Levit |
Subject: |
parsing command substitution inside parameter expansion in interactive shell |
Date: |
Sun, 19 Mar 2023 21:58:17 -0400 |
If a command substitution inside a parameter expansion has a command
followed by a newline, bash prints an error message (though the
command is parsed and saved in the history list correctly):
bash --norc -in <<<$'${_+$(:\n)}\n!!'
$ ${_+$(:
bash: command substitution: line 3: unexpected EOF while looking for
matching `)'
> )}
$ !!
${_+$(:; )}
If the command substitution starts with a newline, no error is printed
but the command is _not_ saved correctly to the history list (a
semicolon is inserted at the start):
bash --norc -in <<<$'${_+$(\n:)}\n!!'
$ ${_+$(
> :)}
$ !!
${_+$(; :)}
- parsing command substitution inside parameter expansion in interactive shell,
Grisha Levit <=