zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: Function code breaking out of if then ...fi
Date: Mon, 5 Nov 2012 16:08:18 +0000	[thread overview]
Message-ID: <CAECNH1TNJpcLo5YcFDZ3F1zOFc4=ncajQ9BR+YEYQCREQA7MyA@mail.gmail.com> (raw)
In-Reply-To: <20121105145501.50c674f1@pwslap01u.europe.root.pri>

Another inconsistency with error handling...

% fn() { setopt mumbly; print Got here; }
% fn
fn:setopt: no such option: mumbly
Got here
% fn() { set -o mumbly; print Got here; }
% fn
fn:set: no such option: mumbly

This is because set is a POSIX special builtin but setopt isn't.  It
should be documented, however.

Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.145
diff -p -u -r1.145 builtins.yo
--- Doc/Zsh/builtins.yo	11 Oct 2012 20:14:03 -0000	1.145
+++ Doc/Zsh/builtins.yo	5 Nov 2012 16:06:10 -0000
@@ -1361,6 +1361,11 @@ or without the tt(no) prefix remains the
 If the tt(-m) flag is given the arguments are taken as patterns
 (which should be quoted to protect them from filename expansion), and all
 options with names matching these patterns are set.
+
+Note that a bad option name does not cause execution of shell code
+to be aborted; this is different from `tt(set -o)'.  This is because
+tt(set) is regarded as a special builtin by the POSIX standard,
+but tt(setopt) is not.
 )
 findex(shift)
 cindex(parameters, positional)

pws


  reply	other threads:[~2012-11-05 16:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-02  9:09 Michal Maruska
2012-11-02 21:39 ` Bart Schaefer
2012-11-05  8:22   ` Han Pingtian
2012-11-05  9:31     ` Han Pingtian
2012-11-05 14:29   ` Peter Stephenson
2012-11-05 14:55     ` Peter Stephenson
2012-11-05 16:08       ` Peter Stephenson [this message]
2012-11-06  6:47         ` Han Pingtian
2012-11-09 22:52       ` Peter Stephenson
2012-11-10  1:13         ` Bart Schaefer
2012-11-10 21:23           ` Peter Stephenson
2012-11-12 10:24             ` 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='CAECNH1TNJpcLo5YcFDZ3F1zOFc4=ncajQ9BR+YEYQCREQA7MyA@mail.gmail.com' \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /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).