help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] A 'for' loop through an empty directory


From: Christophe Lohr
Subject: Re: [Help-bash] A 'for' loop through an empty directory
Date: Mon, 27 Oct 2014 18:30:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.1.2

Le 27/10/2014 13:09, Greg Wooledge a écrit :
On Mon, Oct 27, 2014 at 10:18:07AM +0100, Christophe Lohr wrote:
Let's try:
  $ for i in /foobar/* ; do echo $i; done
/foobar/*

Why do I get the string '/foobar/*' and not nothing?
There is a bash option, "shopt -s nullglob", which will cause the
script to act as you expect.

Thank you.
This is explained in the man but I did not understand.

Regards
Christophe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]