Whitespace in dir names (bash script problem)




The line...

target_dir="/mount/MP3 Player"

barfs (all references) with a "binary operator expected" (it reads the
MP3 bit, then treats the whitespace as a lead to a parameter, or
something?)

The best info I could dig up says that escaping the whitespace with a
backslash is the way to go here, but...

target_dir="/mount/MP3\ Player"

target_dir="/mount/MP3 \Player"

target_dir="/mount/MP3\Player" (This reads as "MP3Player")

....all barf too.


For practice, I've been doing...

ls /mount/MP3 Player (no such file or directory)

ls /mount/MP3\ Player (no such file or directory)

....and so on, as this generates the same problem a little easier than
constantly hacking the script.



Anybody got a clue on how to get a bash script variable to read a dir
name with whitespace in it? As the automounter assigns this troublesome
name, I think I'm stuck with it for now. :(

--
*===( http://principiadiscordia.com/
*===( http://www.badphorm.co.uk/
*===( http://www.zenwalk.org/
.



Relevant Pages