Wildcards not being substituted
- by user21463
#!/bin/bash
loc=`echo ~/.gvfs/*/DCIM/100_FUJI`
rm -f /mnt/fujifilmA100
ln -s "$loc" /mnt/fujifilmA100
For some reason the variable * doesn't get substituted with the only possible value and gets given the value /home/chris/.gvfs/*/DCIM/100_FUJI. Does anyone have an idea of why?
Please note:
If global expansion fails, the pattern is not substituted. I ran the
commands:
chris@comp2008:~$ loc=`echo ~/.gvfs/*/DCIM/100_FUJI `
chris@comp2008:~$ echo $loc
/home/chris/.gvfs/gphoto2 mount on usb%3A001,008/DCIM/100_FUJI
So we can see the expansion should
work
I have now switched to using:
loc = `find ~/.gvfs -name 100_FUJI `
I am just curious why it doesn't work as is.
Debugging output using sh -x
echo /home/chris/.gvfs/*/DCIM/100_FUJI
loc=/home/chris/.gvfs/*/DCIM/100_FUJI
rm -f /mnt/fujifilmA100
ln -s /home/chris/.gvfs/*/DCIM/100_FUJI/mnt/fujifilmA100