Date:        Sun, 2 Apr 2023 17:48:24 +0200
    From:        Martin Schulte <[email protected]>
    Message-ID:  <[email protected]>

  | in the following lines I consider dash's behaviour as correct
  | an bash's as wrong:

All other shells (even ksh93) not just dash.

I suspect the issue is that the string after %% is not regarded as
quoted, even when the expansion is, and that in

  | $ bash        -c 'option2="test{<().["; echo "${option2%%[<().[]*}"'

bash is parsing the <() as a process substitution, producing nothing.
The only chars in the bracket expression will then be . and [ which
explains the result.

Try instead

        bash        -c 'option2="test{<().["; echo "${option2%%[\<().[]*}"'

and you'll see the difference.   That form should work for all shells.

kre


Reply via email to