[Top][All Lists]

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

Re: Forcing For Loop To Accept Spaces

From: Brian J. Fox
Subject: Re: Forcing For Loop To Accept Spaces
Date: Thu, 18 Apr 2002 12:42:06 -0700

Please try:

for i in "foo bar" bar "bar baz"; do rm -i "$i"; done


   Date: Thu, 18 Apr 2002 11:25:41 -0700
   From: Ian Macdonald <address@hidden>
   Cc: Paul Jarc <address@hidden>

   On Thu 18 Apr 2002 at 12:11:47 -0600, you wrote:

   > Paul Jarc stated the following:
   > > 
   > > SoloCDM <address@hidden> wrote:
   > > 
   > > > How do I force a for loop to except files with spaces in their
   > > > names?
   > > 
   > > Quote the spaces.  (BTW, you mean "accept", not "except". "except" is
   > > nearly the opposite of what you mean.)
   > It didn't work.  Even with the quotes around the whole name it didn't
   > work.

   What are you using?

   This works for me:

   address@hidden ~]$ for i in 'foo bar'; do echo $i; done
   foo bar

   Ian Macdonald               | Every man is as God made him, ay, and often
   address@hidden             | worse.   -- Miguel de Cervantes 

== The Difference Between Cultures: ==
    Einigkeit und Recht und Freiheit
    Liberte', E'galite', Fraternite'
    Sex, drugs and rock'n'roll

reply via email to

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