Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Vim syntax file for zsh
- X-seq: zsh-users 8292
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Vim syntax file for zsh
- Date: Sat, 11 Dec 2004 16:13:00 +0000
- In-reply-to: <20041211132452.GA9461@xxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20041209144520.GC9424@xxxxxxxxxxxxxxxxxx> <dc507f4a04120908364a032da6@xxxxxxxxxxxxxx> <20041209181813.GF9424@xxxxxxxxxxxxxxxxxx> <20041209182347.GG9424@xxxxxxxxxxxxxxxxxx> <20041209200941.GA27510@xxxxxxxxx> <20041209212423.GA21023@xxxxxxxxxxxxxxxxxx> <20041210081358.GA4716@sc> <20041210152749.GB10054@xxxxxxxxxxxxxxxxxx> <20041210154620.GD4716@sc> <20041211132452.GA9461@xxxxxxxxxxxxxxxxxx>
On Sat, Dec 11, 2004 at 02:24:52PM +0100, Nikolai Weibull wrote:
> * Stephane Chazelas <Stephane_Chazelas@xxxxxxxx> [Dec 10, 2004 16:50]:
> > > > If that "[" should be quoted, then that one in:
>
> > > > [ -n "$1" ]
>
> > > > should be to:
>
> > > > '[' -ne "$1" ]
>
> > > Why?
>
> > Because "[" and "hi[" are both arguments to a builtin command (0th of
> > the "[" one, and 1st of the "echo" one), there's no reason (not) to
> > quote one and not the other.
>
> I think you misunderstand.
>
> % echo hi[
> zsh: bad pattern: hi[
> % [ -n "$1" ]
> %
>
> Quoting the first makes sense if you want to echo the string "hi[".
> Quoting the [ in [ -n "$1" ] makes no sense at all.
> Or am I misunderstanding something?
[...]
Yes, you're right, I had not made the test myself as I expected
it to work the same as in any other shell.
echo foo[
works OK in every shell but zsh.
If you've got a command named foo[, though,
foo[ bar
doesn't work with ksh or bash (because, they take it as the
start of an array subscript assignment). It's OK with pdksh,
though.
Is there any reason why
echo [
works and not
echo foo[
in zsh?
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author