zsh-workers
 help / color / mirror / code / Atom feed
From: Eskandar Ensafi <esky@CS.UCLA.EDU>
To: zsh-workers@math.gatech.edu,
	Carlos Carvalho <carlos@riglos.fisica.ufpr.br>
Subject: Re: beta 19 cannot run this script
Date: Wed, 05 Jun 1996 11:00:46 -0700	[thread overview]
Message-ID: <9606051800.AA08332@marathon.cs.ucla.edu> (raw)


Hello,

On Wed, 05 Jun 1996 14:31:00 EST, Carlos Carvalho wrote:
> I tried this and it doesn't work :-(

You didn't do exactly what Bart suggested!

You must put double quotes around "$APS_BASEDIR" to force [ -z ... ] to
see a null argument.  Without double quotes, [ -z ... ] might not see an
argument if the variable is empty or undefined!

The difference is that when $APS_BASEDIR is empty or undefined, the test
[ -z $APS_BASEDIR ] becomes [ -z ], which makes no sense, but written as
[ -z "$APS_BASEDIR" ], it becomes [ -z "" ], which makes perfect sense.

If you don't want to fuss with quotes, then you can write your script in
ksh syntax using [[ ... ]] instead of [ ... ].  This test syntax is fully
supported in zsh, but you will lose compatibility with /bin/sh.  Simply
say [[ -z $APS_BASEDIR ]] -- the advantage of [[ ... ]] is that undefined
and empty variables will be treated as null arguments.

Later,

Eskandar



             reply	other threads:[~1996-06-05 18:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-05 18:00 Eskandar Ensafi [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-06-05 16:59 Carlos Carvalho
1996-06-05 16:03 ` Bart Schaefer
1996-06-05 19:31   ` Carlos Carvalho
1996-06-05 18:11     ` Mike Kazda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9606051800.AA08332@marathon.cs.ucla.edu \
    --to=esky@cs.ucla.edu \
    --cc=carlos@riglos.fisica.ufpr.br \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).