zsh-users
 help / color / mirror / code / Atom feed
From: Richard Coleman <coleman@math.gatech.edu>
To: Toshi Isogai <toshi_isogai@maxtor.com>
Cc: zsh-users@math.gatech.edu
Subject: Re: Filename Expansion
Date: Thu, 19 Oct 1995 21:57:00 -0400	[thread overview]
Message-ID: <9510200157.AA24325@redwood.skiles.gatech.edu> (raw)
In-Reply-To: Your message of "Thu, 19 Oct 1995 18:52:02 MDT." <Pine.SUN.3.91.951019183157.2004D-100000@wolfcreek>

> I am writing a script to search files in a certain pattern
> and manipulate them. Something like:
> 
> 	for i in *.vhd; do
>  		# do some operation on $i here
> 	done
> 	# do other stuff
> 
> 
> This works fine if there is at least one file matches the
> pattern. Otherwise, it exits with an error and 'other stuff'
> never gets done.
> 
> How can I make it so that it will just skip 'for' loop if
> there aren't any files matches the pattern?


for i in *.vhd(N); do
   # do some stuff
done

The (N) says to use the nullglob option for this particular
glob pattern.

Richard Coleman
coleman@math.gatech.edu


      parent reply	other threads:[~1995-10-20  2:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-10-20  0:52 Toshi Isogai
1995-10-20  1:52 ` Zefram
1995-10-20  2:04   ` Vincent Lefevre
1995-10-20  1:57 ` Richard Coleman [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=9510200157.AA24325@redwood.skiles.gatech.edu \
    --to=coleman@math.gatech.edu \
    --cc=toshi_isogai@maxtor.com \
    --cc=zsh-users@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).