On 4/15/22 11:52 AM, Martin Schulte wrote:
Hello bash-bughunters,

please consider the following interactive lines:

It turns out that running it in an interactive shell is the key.


$ echo $BASH_VERSION
5.1.4(1)-release
$ uname -a
Linux t1 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux
$ echo $BASH_VERSION
5.1.4(1)-release
$ sleep $(expr 60 - $(date +%s')) ; date
bash: command substitution: line 417: unexpected EOF while looking for matching 
`''
bash: command substitution: line 418: syntax error: unexpected end of file
bash: unexpected EOF while looking for matching `)'
$

At this point it looks as if bash has encountered the problem and thus not 
executed the command line - fine.

Things get strange when you enter a command, e.g. echo:

$ echo


To get out of this you can enter the missing single quote followed by two 
closing braces:

(Well, parens ;-) )

Because those are the missing delimiters. The problem is actually bash
jumping back to the top level because it's trying to find the correct
delimiter to store the line in the command-oriented history, not anything
to do with the parser per se.

It works in bash-5.2, which does command substitution parsing completely
differently.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to