bash: expanding variables with spaces
- by adam n
i have a file called physics 1b.sh
in bash, if i try
x="physics 1b"
grep "string" "$x".sh
grep complains:
grep: physics 1b: No such file or directory. However, when i do
grep "string" physics\ 1b.sh
it works fine. So i guess the problem is something to do with the variable not being expanded to include the backslash that grep needs to recognize the space. How do i get this to work?
using bash 3.2, mac os 10.6.