Mike Bird wrote:

On Sun, 2006-02-12 at 11:23, David Berg wrote:

I'm trying to write a for loop that descends into a list of
directories and runs a command.  I can't seem to get the quoting right
though.  Most of the directories have spaces and they are making
things difficult for me.  Here is what I have:

for DIR in dir\ 1 dir\ 2 dir\ 3; do
       cd $DIR
       pwd
       cd ..
done

The spaces in $DIR aren't escaped.

Any help, including a pointer to the relevant part of TFM, is much appreciated.


cd "$DIR"

Regarding the "FM" pointer request:


See "man bash" and the section titled "QUOTING."

Daniel




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to