rhdinah
December 24th, 2010, 06:31 AM
Given a directory on the Desktop named "A B" ... embedded blank in the name.
and a +x script named lsl in the home directory:
#!/bin/bash
DIR="~/Desktop/A B"
ls -d ~/Desktop/A\ B
ls -d $DIR
when the script is invoked the following is observed:
me@machine:~$ ./lsl
/home/me/Desktop/A B
ls: cannot access ~/Desktop/A: No such file or directory
ls: cannot access B: No such file or directory
me@machine:~$
Normally on the CL you escape out the space, but how do you accomplish such a thing within a script using variables.
You can try to escape out the blank in the variable assignment but nothing comes of it. So basically how is this done with variables? :D
Actually it's pretty embarrassing to ask this, but I've been working on it for hours.
I can't find much on the Internet other than embedded blank file traversing iterations which is really not what I need.
Thanks!
and a +x script named lsl in the home directory:
#!/bin/bash
DIR="~/Desktop/A B"
ls -d ~/Desktop/A\ B
ls -d $DIR
when the script is invoked the following is observed:
me@machine:~$ ./lsl
/home/me/Desktop/A B
ls: cannot access ~/Desktop/A: No such file or directory
ls: cannot access B: No such file or directory
me@machine:~$
Normally on the CL you escape out the space, but how do you accomplish such a thing within a script using variables.
You can try to escape out the blank in the variable assignment but nothing comes of it. So basically how is this done with variables? :D
Actually it's pretty embarrassing to ask this, but I've been working on it for hours.
I can't find much on the Internet other than embedded blank file traversing iterations which is really not what I need.
Thanks!