Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Incompatibility when Zsh invoked as 'sh'



In the last episode (Feb 04), DervishD said:
>     The problem is a 'case' like this (abbreviated):
> 
>     case "$1" in
>         [*)  ....
>             ;;
>         *)   ....
>             ;;
>     esac
> 
>     Well, the error is the '[*' pattern, which zsh says is a 'bat
> pattern'. Bash treats it as the regex 'match an opening bracket and
> anything after it', but zsh doesn't.

couple datapoints:

ash does not complain; args starting with a bracket match the 1st case.

pdksh-5.2.14 run as sh does not complain, but only the literal argument
  [* matches.

The ash manpage, at least, explicitly allows this case:

     A left bracket ([) introduces a character class.  The end of the
     character class is indicated by a ``]''; if the ``]'' is missing
     then the ``['' matches a ``['' rather than introducing a character
     class.

I don't have a link to the new Single Unix spec at the moment; what's
it say?

-- 
	Dan Nelson
	dnelson@xxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author