Shell script help
Colin Law
clanlaw at gmail.com
Wed Oct 15 14:43:38 UTC 2014
This is not strictly a Ubuntu issue but I hope someone will take pity
on me. I am trying to write a shell script (it is in ash rather than
bash but I don't think that is an issue here) that is given a
parameter that is a partial directory name and may have spaces in it.
I will call it with something like
myscript "dir name"
In the script I want to do something like
for f in /some/path/$1/*.txt
do
blah blah
done
but I can't work out out how to quote it so that it keeps the words of
the parameter together but still expands the glob. Google has failed
to help me to find the right incantation to make it work.
Any help would be much appreciated.
Cheers
Colin
More information about the ubuntu-users
mailing list