>我正在处理我的osx 10.11系统中的apm错误。当我跑步时
apm
在我的命令行中,由于文件路径错误,它抛出错误:
/usr/local/bin/apm: line 32: /Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/node: No such file or directory
退房后,我发现:在 apm shell(/Atom.app/Content/Resources/app/apm/node_modules/.bin/apm) 中,有一个 while 循环:
while [ -L "$binDir" ]
do
binDir=`readlink "$binDir"`
builtin cd "`dirname "$binDir"`"
binDir=`basename "$binDir"`
done
似乎这个循环在我的osx系统上只运行一次,在其他系统上运行两次,我遇到的错误就是因为这个。
-L
检查文件是否为符号链接,如果是,则返回 True。从man test
:
-L FILE
FILE exists and is a symbolic link (same as -h)
请参阅一个示例,其中我们创建了一个文件hello
和一个名为 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