Reputation: 150
I am dealing with a bug of apm in my osx 10.11 system. When I run
apm
in my command line, it throw an error because of the wrong file path:
/usr/local/bin/apm: line 32: /Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/node: No such file or directory
After checked out, I found that: In the apm shell(/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm), there is a while loop:
while [ -L "$binDir" ]
do
binDir=`readlink "$binDir"`
builtin cd "`dirname "$binDir"`"
binDir=`basename "$binDir"`
done
It seems like this loop runs only one time on my osx system and runs twice on others, the bug which I have is because of this.
Upvotes: 1
Views: 141
Reputation: 289745
-L
checks whether the file is a symbolic link and returns True if so. From man test
:
-L FILE
FILE exists and is a symbolic link (same as -h)
See an example where we create a file hello
and a (soft)link to it called my_link
:
$ touch hello
$ ln -s hello my_link
$ [ -L "hello" ] && echo "this is a link" || echo "this is NOT a link"
this is NOT a link
$ [ -L "my_link" ] && echo "this is a link" || echo "this is NOT a link"
this is a link
Upvotes: 2