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

Re: Incompatibility when Zsh invoked as 'sh'



On Feb 4, 12:13am, DervishD wrote:
}
}     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.

On Feb 3,  8:51pm, Dan Nelson wrote:
}
} 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.
} 
} I don't have a link to the new Single Unix spec at the moment; what's
} it say?

Anyone who registers their email address can now get the latest Single
Unix spec on line; start at http://www.unix-systems.org/version3/

The spec says:

  When unquoted and outside a bracket expression, the following three
  characters shall have special meaning in the specification of patterns:

  ?   A question-mark is a pattern that shall match any character.
  *   An asterisk is a pattern that shall match multiple characters, as
      described in Patterns Matching Multiple Characters.
  [   The open bracket shall introduce a pattern bracket expression.

It goes on:

  Section 9.3.5, RE Bracket Expression shall also apply to the pattern
  bracket expression, except that the exclamation mark character ( '!' )
  shall replace the circumflex character ( '^' ) in its role in a "non-
  matching list" in the regular expression notation. A bracket expression
  starting with an unquoted circumflex character produces unspecified
  results.

Nothing in section 9.3.5 allows for an unmatched left-bracket to match a
literal bracket.  The description of the "case" construct doesn't make
any exception to this, either.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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