简体   繁体   English

[[: 找不到相关命令

[英][[: Command not found

I'm installing RVM on a system where I don't have sudo permissions.我在没有 sudo 权限的系统上安装 RVM。 It should work fine in theory, but when I added理论上它应该可以正常工作,但是当我添加时

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

to bash_profile, it isn't doing what it's supposed to and it gives me this error到 bash_profile,它没有做它应该做的事情,它给了我这个错误

[[: Command not found.

Anyone know what might be the problem?有谁知道可能是什么问题?

看起来您的 .bash_profile 正在由 bash 以外的 shell 执行。

"[[" .. "]]" is a bash builtin. "[[" .. "]]" 是一个内置的 bash。 Is another shell running the script?另一个 shell 正在运行脚本吗?

Put the following at the top of your script:将以下内容放在脚本的顶部:

#!/bin/bash

This will enforce bash to be the interpreting shell.这将强制bash成为解释 shell。 As mentioned in other answers, [[ ]] is a bashism and not POSIX syntax.正如其他答案中提到的, [[ ]]是一种 bashism 而不是 POSIX 语法。

RVM is not (yet) compatible with csh, only bash and zsh >= 4.3.5 are supported. RVM(尚未)与 csh 兼容,仅支持 bash 和 zsh >= 4.3.5。

(see http://rvm.io/rvm/prerequisites/ ) (见http://rvm.io/rvm/prerequisites/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM