Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bracket expressions and POSIX
- X-seq: zsh-workers 15185
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Clint Adams <clint@xxxxxxx>, zsh-workers@xxxxxxxxxx
- Subject: Re: bracket expressions and POSIX
- Date: Sat, 30 Jun 2001 02:14:39 +0000
- In-reply-to: <20010629142215.A8431@xxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20010629142215.A8431@xxxxxxxx>
On Jun 29, 2:22pm, Clint Adams wrote:
} Subject: bracket expressions and POSIX
}
} POSIX says that \ loses its special meaning within a bracket
} expression for pattern matching and also that ! is the
} ^ character in that context.
}
} So this strikes me as non-compliant:
}
} % emulate sh
} % touch \\test abc
} % echo [!a]*
} zsh: event not found: a]
Try it with `emulate -R sh'. Just `emulate sh' does not turn on all the
POSIX shell emulation options -- in particular `banghist' is still set,
and history references take precedence over glob patterns.
} % echo [\!a]*
} \test
} % echo [\]*
} []*
} % echo [\\]*
} \test
With `emulate -R sh' I get:
$ ls
\test abc
$ echo [!a]*
\test
$ echo [\!a]* <- That one is especially odd.
\test
$ echo [\]*
[]*
$ echo [\\]*
\test
$ setopt badpattern
$ echo [\]*
zsh: bad pattern: []*
So it appears that zsh is in fact not POSIX-compliant with respect to
backslashes inside brackets, but is OK with respect to `!'.
$ echo [\\!a]*
\test abc
--
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