[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syntax error while parsing a case command within `$(...)'
From: |
Eli Schwartz |
Subject: |
Re: syntax error while parsing a case command within `$(...)' |
Date: |
Sun, 14 Feb 2021 15:04:26 -0500 |
On 2/14/21 2:43 PM, Dale R. Worley wrote:
> Before we worry about what to change, I want to note that the original
> example is syntactically incorrect. The example is
>
> $ bash -c ': $(case x in x) esac)'
>
> But the manual page makes it clear that each case must be ended with
> ";;".
>
> case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac
>
> Now, I haven't investigated what cleverness Bash uses, but all the cases
> I've tested that conform to the case syntax are handled correctly inside
> this $(...):
>
> $ bash -c ': $( case x in x) : ;; esac )'
> $ bash -c ': $( case x in x) true ;; esac )'
> $ bash -c ': $( case x in (x) true ;; esac )'
>
> It even works with the degenerate case where there are no coices, though
> writing it is hard because "esac" is a keyword:
>
> $ bash -c ': $( case x in
> more> esac )'
>
> This is with an old version, 4.2.53(1).
$ bash -c ': $( case x in x)
esac ); echo $?'
0
Doesn't seem like a special power of your degenerate case. Just a
running trend that esac does not get recognized without a separator.
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
- Re: syntax error while parsing a case command within `$(...)', (continued)
Re: syntax error while parsing a case command within `$(...)', Dale R. Worley, 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 `$(...)', Lawrence Velázquez, 2021/02/14
- Re: syntax error while parsing a case command within `$(...)', Dale R. Worley, 2021/02/16
- Re: syntax error while parsing a case command within `$(...)', Lawrence Velázquez, 2021/02/17
- Re: syntax error while parsing a case command within `$(...)', Dale R. Worley, 2021/02/17
- Re: syntax error while parsing a case command within `$(...)', Lawrence Velázquez, 2021/02/18
Re: syntax error while parsing a case command within `$(...)',
Eli Schwartz <=
Re: syntax error while parsing a case command within `$(...)', Chet Ramey, 2021/02/15
- Re: syntax error while parsing a case command within `$(...)', Koichi Murase, 2021/02/15
- Re: syntax error while parsing a case command within `$(...)', Chet Ramey, 2021/02/15
- Re: syntax error while parsing a case command within `$(...)', Oğuz, 2021/02/16
- Re: syntax error while parsing a case command within `$(...)', Koichi Murase, 2021/02/16
- Re: syntax error while parsing a case command within `$(...)', Oğuz, 2021/02/16
- Re: syntax error while parsing a case command within `$(...)', Koichi Murase, 2021/02/16