bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash seems confused about it's state after unclosed single quotes in nes


From: Martin Schulte
Subject: bash seems confused about it's state after unclosed single quotes in nested command substitution
Date: Fri, 15 Apr 2022 17:52:33 +0200

Hello bash-bughunters,

please consider the following interactive lines:

$ 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:

> '))
expr: non-integer argument
sleep: missing operand
Try 'sleep --help' for more information
$

Now you can go on as expected, the last command in history is $'echo\n\'))' and 
the 'sleep ...' is not in the history at all.

I would either have expected to get PS2 and no error messages after entering 
the line starting with sleep or being able to just enter the next command.

Best regards

Martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]