apm(atom 的包管理器)启动 shell 运行 错误

the apm(the package manager of atom) start shell run error

我正在处理 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

查看后发现: 在apmshell(/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 检查文件是否是符号文件 link 和 returns 如果是则为真。来自 man test:

   -L FILE
          FILE exists and is a symbolic link (same as -h)

查看示例,其中我们创建了一个文件 hello 和一个名为 my_link:

的(软)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