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: Andreas Kusalananda Kähäri
Subject: Re: syntax error while parsing a case command within `$(...)'
Date: Sun, 14 Feb 2021 08:39:51 +0100

On Sun, Feb 14, 2021 at 12:02:02AM +0100, Andreas Schwab wrote:
> 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.

And using (x) doesn't help:

% bash -c ': $(case x in (x) esac)'
bash: -c: line 1: unexpected EOF while looking for matching `)'
bash: -c: line 2: syntax error: unexpected end of file


-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



reply via email to

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