I have a number of directories with spaces in their names. I wanted to write
a script that steps through them but found it was difficult to cd to dirs
with spaces. Would someone mind giving me a few suggestions?
$ mkdir "My Directory With Spaces"
$ cd "My Directory With Spaces" # works fine
$ cd ..
$ a="cd \"My Directory With Spaces\""
$ echo $a
cd "My Directory With Spaces"
$ $($a) # I thought this would work
bash: cd: "My: No such file or directory
eval "$a"
Or:
a="My Directory With Spaces"
cd "$a"
--
Chris F.A. Johnson http://cfaj.freeshell.org
=================================================================
Everything in moderation -- including moderation