/tmp/vagrant-shell:第15行:[-d:命令未找到[重复]

时间:2021-01-07 23:57:21

This question already has an answer here:

这个问题已经有了答案:

I am using vagrant on a rails project. I' am checking to make sure that RVM is not globally installed and uninstalling RVM if it is with this script:

我在一个rails项目上使用流浪。我正在检查,以确保RVM不是全局安装和卸载的,如果它是用这个脚本:

if [-d "/usr/local/rvm"]; then
    yes yes | sudo rvm implode
fi

I'm getting this error in output /tmp/vagrant-shell: line 15: [-d: command not found

我在输出/tmp/vagrant-shell中得到这个错误:第15行:[-d:命令未找到。

Why isn't -d working?

为什么不是- d工作吗?

1 个解决方案

#1


3  

The space between [ and -d is required, as [ is not special syntax, but a simple command name. As such, [-d is also a valid command name, but one that is unlikely to be found.

[和-d之间的空格是必需的,因为[不是特殊的语法,而是一个简单的命令名。因此,[-d也是一个有效的命令名,但不太可能找到。

#1


3  

The space between [ and -d is required, as [ is not special syntax, but a simple command name. As such, [-d is also a valid command name, but one that is unlikely to be found.

[和-d之间的空格是必需的,因为[不是特殊的语法,而是一个简单的命令名。因此,[-d也是一个有效的命令名,但不太可能找到。