apm(atom的包pipe理器)启动shell运行错误
我正在处理我的osx 10.11系统中的apm错误。 当我跑步
apm
在我的命令行中,由于错误的文件path导致错误:
/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
检查文件是否是符号链接,如果是,则返回True。 从man test
:
-L FILE FILE exists and is a symbolic link (same as -h)
看一个例子,我们创build一个文件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