zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Ulrik Haugen <qha@lysator.liu.se>
Cc: zsh-workers@sunsite.dk
Subject: Re: BUG: cd '' doesn't produce an error
Date: Fri, 30 Dec 2005 08:28:41 -0800	[thread overview]
Message-ID: <20051230162841.GA30078@dot.blorf.net> (raw)
In-Reply-To: <877j9mycf9.fsf@haugen.visit.se>

On Fri, Dec 30, 2005 at 01:52:42PM +0100, Ulrik Haugen wrote:
> Right now zsh silently ignores my error

It would be better to address this aspect of the problem rather than
trying to change the cd command.  There are a couple ways to deal with
this:

1.  Specify "setopt no_unset err_exit" in the script.  This will ensure
    that no unset variable will ever be silently expanded into an empty
    string unless you explicitly request it via ${FOO:-} .

2.  Use a single must-be-defined check via ${FOO:?}, like this:

    scriptdir=`dirname "$0"`
    scriptdir=`cd "${scriptdir:?}"&& pwd`

    That will output a "parameter not set" error for a single variable
    instead of all variables.  The documentation claims that this error
    should cause the shell to exit, but in my testing it did not do so
    without the err_exit option also being set.

..wayne..


  reply	other threads:[~2005-12-30 16:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-21  2:03 Ulrik Haugen
2005-12-21 10:21 ` Peter Stephenson
2005-12-30 12:52   ` Ulrik Haugen
2005-12-30 16:28     ` Wayne Davison [this message]
2006-01-04 17:32       ` Wayne Davison
2006-01-04 19:48       ` Ulrik Haugen
2006-01-04 11:41     ` Peter Stephenson
2006-01-04 13:06       ` Peter Stephenson
2006-01-04 17:48       ` Peter Stephenson
2006-01-04 22:30       ` Ulrik Haugen
2006-01-05 12:29         ` Peter Stephenson

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=20051230162841.GA30078@dot.blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=qha@lysator.liu.se \
    --cc=zsh-workers@sunsite.dk \
    /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).