我正在处理我的 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/Contents/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
检查文件是否是符号链接(symbolic link),如果是则返回 True。来自人测试
:
-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
关于node.js - apm(atom的包管理器)启动shell运行错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37656091/