I’m writing a bash script on Mac OS X that makes a symlink but when I try and open the symlink that I created it doesn’t go anywhere and I get an error that it can’t find the original.
OriginalPath="~/PathTo/bundle1.bundle"
NewPath="/OtherPath/bundle1.bundle"
sudo ln -s $OriginalPath $NewPath
I’ve also tried this:
sudo ln -s ${OriginalPath} ${NewPath}
Assuming
${OriginalPath}already exists (and if it doesn’t, hey, that’s your problem):The first thing I’d look at is to see if the tilde expansion is the problem. Change
OriginalPathto the full path name (e.g.,/Users/jpc/PathTo/bundle1.bundle). If that fixes the problem, then either just go with that or find out how to turn on tilde expansion in the shell or use the environment variable${HOME}instead of tilde expansion.Probably best not to use tilde expansion in the shell script anyway, as you might not be able to make sure that all users running the script will have it turned on.