14 Şubat 2021 Pazar tarihinde Dale R. Worley <wor...@alum.mit.edu> yazdı:

> 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
> ";;".


`;;' is optional for the last case item.


>
>        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 )'


`case x in esac' (without the linebreak) works fine outside the command
substitution.


> This is with an old version, 4.2.53(1).
>
> Dale
>


-- 
Oğuz

Reply via email to