Re: syntax error while parsing a case command within `$(...)'
From:
Andreas Schwab
Subject:
Re: syntax error while parsing a case command within `$(...)'
Date:
Sun, 14 Feb 2021 00:02:02 +0100
User-agent:
Gnus/5.13 (Gnus v5.13) Emacs/27.1.91 (gnu/linux)
On Feb 14 2021, Robert Elz wrote:
> Date: Sat, 13 Feb 2021 23:21:36 +0300
> From: =?UTF-8?B?T8SfdXo=?= <oguzismailuysal@gmail.com>
> Message-ID:
> <CAH7i3LrrtgJSZWXFK_5zSNvTwTue9a9j7K=iC=Lw2PBpecW6jQ@mail.gmail.com>
>
> | $ bash -c ': $(case x in x) esac)'
>
> This is a well known bash deficiency. When parsing command substitutions
> it (approximately) simply counts (unquoted) parentheses to find the end.
> Anything with a valid closing ')' but with no opening '(' confuses it.
Bash already handles that properly, when the compound-list is non-empty.
$ bash -c ': $(case x in x) :; esac)'
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."