* [ -z $FOO ] seems broken in beta13
@ 1996-06-10 16:35 Clint Olsen
1996-06-10 17:03 ` Zefram
0 siblings, 1 reply; 5+ messages in thread
From: Clint Olsen @ 1996-06-10 16:35 UTC (permalink / raw)
To: zsh-workers
Hello:
I use [ -z $TERM ] to check for terminal settings, and since we revved up
from 2.5, I'm now forced to use $+TERM.
Now I get "argument expected". Is this correct?
-Clint
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ -z $FOO ] seems broken in beta13
1996-06-10 16:35 [ -z $FOO ] seems broken in beta13 Clint Olsen
@ 1996-06-10 17:03 ` Zefram
1996-06-10 17:18 ` Hrvoje Niksic
1996-06-10 17:34 ` Zoltan Hidvegi
0 siblings, 2 replies; 5+ messages in thread
From: Zefram @ 1996-06-10 17:03 UTC (permalink / raw)
To: Clint Olsen; +Cc: zsh-workers
>I use [ -z $TERM ] to check for terminal settings, and since we revved up
>from 2.5, I'm now forced to use $+TERM.
>
>Now I get "argument expected". Is this correct?
Yes. If $TERM is empty, then $TERM will be removed from the command
line completely, leaving `[ -z ]`, which is a syntax error. If you use
"$TERM" (note the quotes), then the result will be `[ -z "" ]`, which
is legal.
-zefram
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ -z $FOO ] seems broken in beta13
1996-06-10 17:03 ` Zefram
@ 1996-06-10 17:18 ` Hrvoje Niksic
[not found] ` <hniksic@srce.hr>
1996-06-10 17:34 ` Zoltan Hidvegi
1 sibling, 1 reply; 5+ messages in thread
From: Hrvoje Niksic @ 1996-06-10 17:18 UTC (permalink / raw)
To: ZSH Workers Mailing List
Zefram (A.Main@dcs.warwick.ac.uk) wrote:
>
> >I use [ -z $TERM ] to check for terminal settings, and since we revved up
> >from 2.5, I'm now forced to use $+TERM.
> >
> >Now I get "argument expected". Is this correct?
>
> Yes. If $TERM is empty, then $TERM will be removed from the command
> line completely, leaving `[ -z ]`, which is a syntax error. If you use
> "$TERM" (note the quotes), then the result will be `[ -z "" ]`, which
> is legal.
I thought you got this behaviour only by turning on shwordsplit?
--
hniksic@srce.hr | Student of electrical engineering
hniksic@fly.cc.fer.hr | University of Zagreb, Croatia
------------------------------------------------------------------
`VI' - An editor used by those heretics that don't subscribe to
the Emacs religion.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ -z $FOO ] seems broken in beta13
1996-06-10 17:03 ` Zefram
1996-06-10 17:18 ` Hrvoje Niksic
@ 1996-06-10 17:34 ` Zoltan Hidvegi
1 sibling, 0 replies; 5+ messages in thread
From: Zoltan Hidvegi @ 1996-06-10 17:34 UTC (permalink / raw)
To: Zefram; +Cc: olsenc, zsh-workers
> >I use [ -z $TERM ] to check for terminal settings, and since we revved up
> >from 2.5, I'm now forced to use $+TERM.
> >
> >Now I get "argument expected". Is this correct?
>
> Yes. If $TERM is empty, then $TERM will be removed from the command
> line completely, leaving `[ -z ]`, which is a syntax error. If you use
> "$TERM" (note the quotes), then the result will be `[ -z "" ]`, which
> is legal.
Actually POSIX says that
with no arguments test should exit with status 1.
With 1 argument it should exit true iff that argument is non-null (this
means that `test -n' and `test -z' both exit true).
With 2 arguments: if $1 is a bang `!' exit true iff $2 is null. If $1 is
an unary operator, exit true iff the unary test is true.
etc.
I'll modify zsh according to this.
Zoltan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ -z $FOO ] seems broken in beta13
[not found] ` <hniksic@srce.hr>
@ 1996-06-10 19:41 ` Bart Schaefer
0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 1996-06-10 19:41 UTC (permalink / raw)
To: ZSH Workers Mailing List
On Jun 10, 7:18pm, Hrvoje Niksic wrote:
} Subject: Re: [ -z $FOO ] seems broken in beta13
}
} Zefram (A.Main@dcs.warwick.ac.uk) wrote:
} >
} > >I use [ -z $TERM ] to check for terminal settings, and since we revved up
} > >from 2.5, I'm now forced to use $+TERM.
} > >
} > >Now I get "argument expected". Is this correct?
} >
} > Yes. If $TERM is empty, then $TERM will be removed from the command
} > line completely, leaving `[ -z ]`, which is a syntax error. If you use
} > "$TERM" (note the quotes), then the result will be `[ -z "" ]`, which
} > is legal.
}
} I thought you got this behaviour only by turning on shwordsplit?
Probably that was true at one time.
In any case, it would be nice to be able to get a Bourne-shell-compatible
"test" as well as a POSIX-compatible "test". As demonstrated here before,
bash appears to use the POSIX semantics, but sh and ksh use the "argument
expected" semantics quoted above.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1996-06-10 19:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-10 16:35 [ -z $FOO ] seems broken in beta13 Clint Olsen
1996-06-10 17:03 ` Zefram
1996-06-10 17:18 ` Hrvoje Niksic
[not found] ` <hniksic@srce.hr>
1996-06-10 19:41 ` Bart Schaefer
1996-06-10 17:34 ` Zoltan Hidvegi
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).