[[: Command not found

淺唱寂寞╮ 提交于 2019-12-20 02:14:35

问题


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:


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.




回答3:


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




回答4:


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

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



来源:https://stackoverflow.com/questions/4831389/command-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!