Bash Scripting Directories with Spaces
I am having a hell of a time figuring out how to script something in BASH -
Specifically directories with spaces!!!
So the backslash is an escape character? How do I navigate spaced directories?
#!/bin/bash
DIRECTORY=/some\ music/
echo cd $DIRECTORY #the echo is cd /some music/
cd $DIRECTORY
so maybe i'll try:
DIRECTORY=/some\\ music/
echo cd $DIRECTORY #the echo is music/: no such file or directory
cd $DIRECTORY
i've tried quoting it ; triple slashing it ; nothing seems to be working
what's the deal?? I got one of the commands to echo the right setup:
cd /some\ music/
but when i had the actualy command cd $DIRECTORY it erred and said :
directory: /some\ not found !
any ideas?
|