bug-bash
[Top][All Lists]
Advanced

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

Re: syntax error while parsing a case command within `$(...)'


From: Oğuz
Subject: Re: syntax error while parsing a case command within `$(...)'
Date: Sun, 14 Feb 2021 07:26:21 +0300

14 Şubat 2021 Pazar tarihinde Robert Elz <kre@munnari.oz.au> yazdı:

>     Date:        Sat, 13 Feb 2021 23:21:36 +0300
>     From:        =?UTF-8?B?T8SfdXo=?= <oguzismailuysal@gmail.com>
>     Message-ID:  <CAH7i3LrrtgJSZWXFK_5zSNvTwTue9a9j7K=iC=Lw2PBpecW6
> jQ@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.
>
> Your example is one, perhaps the most common (and is why the optional
> leading '(' in case patterns was added to the syntax - so it is possible
> to survive with shells that work this way, but ')' in a here doc in the
> command substitution is another).
>
> This problem has been known for a LONG time, without it being fixed.
> Fixing it would take major work in the parser, so the chances of it
> happening are not all that great.


I didn't know that, but I don't think fixing this case only would take
major work.

By the way, Gmail's marking your emails as spam again.


>
> kre
>
>

-- 
Oğuz


reply via email to

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