[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syntax error while parsing a case command within `$(...)'
From: |
Robert Elz |
Subject: |
Re: syntax error while parsing a case command within `$(...)' |
Date: |
Sun, 14 Feb 2021 05:21:59 +0700 |
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.
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.
kre
- syntax error while parsing a case command within `$(...)', Oğuz, 2021/02/13
- Re: syntax error while parsing a case command within `$(...)',
Robert Elz <=
- Re: syntax error while parsing a case command within `$(...)', Robert Elz, 2021/02/14
- Re: syntax error while parsing a case command within `$(...)', Stephane Chazelas, 2021/02/14
- Re: syntax error while parsing a case command within `$(...)', Robert Elz, 2021/02/14
- Re: syntax error while parsing a case command within `$(...)', Oğuz, 2021/02/14
- Re: syntax error while parsing a case command within `$(...)', Chet Ramey, 2021/02/15