[[: Command not found

2020-04-13 08:41发布

问题:

I'm installing RVM on a system where I don't have sudo permissions. 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

[[: Command not found.

Anyone know what might be the problem?

回答1:

"[[" .. "]]" is a bash builtin. Is another shell running the script?



回答2:

It looks like your .bash_profile is being executed by a shell other than bash.



回答3:

Put the following at the top of your script:

#!/bin/bash

This will enforce bash to be the interpreting shell. As mentioned in other answers, [[ ]] is a bashism and not POSIX syntax.



回答4:

RVM is not (yet) compatible with csh, only bash and zsh >= 4.3.5 are supported.

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



标签: bash rvm