i'm attempting to write a script that copies the contents of an iPod to a desktop folder. the problem comes when the cd command returns a "No such file or directory" error after the script attempts to change the working directory to one inside the iPod. the interesting part is that outside of a script, cd'ing into the iPod works just fine - however, when the script attempts it, the directory apparently does not exist. The iPod does appear in the /Volumes directory, and i have manually copied some files from it with no issue.
can anyone shed light on why my script can't cd into my iPod?
Code:
cd /Volumes
VOLUMES=$(ls)
for vol in $VOLUMES ; do
if [ -O $vol ] ; then
echo $vol > $HOME/Desktop/pod.txt
ipod=$(sed -e "s/ /\\\ /g" -e "s/'/\\\'/g" $HOME/Desktop/pod.txt)
fi
done
mkdir $HOME/Desktop/iPod_Contents
cd /Volumes/$ipod/iPod_Control
cp Music/ $HOME/Desktop/iPod_Contents
exit 0
can anyone shed light on why my script can't cd into my iPod?