From: Chris Hiestand <chiestand@salk.edu>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: zsh-users@zsh.org
Subject: Re: globbing in a for loop may prematurely exit script when sourcing a zsh script
Date: Wed, 31 Jul 2013 12:42:35 -0700 [thread overview]
Message-ID: <76FB9F8A-F28C-46F4-93A9-1D611ABBF026@salk.edu> (raw)
In-Reply-To: <20130731100247.441731f2@pwslap01u.europe.root.pri>
On Jul 31, 2013, at 2:02 AM, Peter Stephenson <p.stephenson@samsung.com> wrote:
> The right thing to do here is tell the shell to expand the pattern to an
> empty string if there are no matches. You can do this without changing
> any options by appending (N) to the pattern, i.e.
>
> for f in /custom/zsh.d/*.zsh(N); do
>
> This behaves as if the NULL_GLOB option was set for that pattern. In
> zsh (but not necessarily other shells) a "for" loop over an empty
> expansion does nothing.
Excellent, this is exactly what I was looking for! Thank you, I knew there must
be some way to do it.
prev parent reply other threads:[~2013-07-31 19:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-31 8:13 Chris Hiestand
2013-07-31 9:02 ` Peter Stephenson
2013-07-31 19:42 ` Chris Hiestand [this message]
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=76FB9F8A-F28C-46F4-93A9-1D611ABBF026@salk.edu \
--to=chiestand@salk.edu \
--cc=p.stephenson@samsung.com \
--cc=zsh-users@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).