smaller sample from a larger script: i'm simply trying to copy files from one desktop directory on a mac to another using variables. when i first test the logic of the script without variables, everything works and the copy is effective.
but i'm unable to call the same copy by passing a variable. script runs as root, FYI. much obliged if you can weigh in. hoping it's just a syntax error that i'm missing.
#!/bin/sh
oldWS="/Volumes/Lion\ BaseOS/Users/workstation"
newWS="/Users/workstation"
echo "Migrating any old Desktop files from $oldWS/Desktop..."
cp "${oldWS}/Desktop/*" "${newWS}/Desktop"
if [ $? != 0 ]; then
echo "There was a problem migrating files from $oldWS/Desktop, PLEASE INVESTIGATE."
else
echo "Files from $oldWS/Desktop have been moved to the new Mac."
fi
exit 0
i'm assuming that i've got a syntax error here but i can't see where. i use similar syntax in other scripts all the time...
thanks for whatever insight you might have to share.
david
---------- Post updated at 03:27 PM ---------- Previous update was at 03:20 PM ----------
forgot to mention the error i'm getting:
cp: /Volumes/Lion\ BaseOS/Users/workstation/Desktop/*: No such file or directory
which is odd as:
a) the directory does exist
b) when i run the cp manually and without variables, it's. just. fine.