我正在尝试通过RVM un Cloud9进行经典的Ruby安装,但是我遇到了bash错误:
bash: 1.1G: syntax error: invalid arithmetic operator (error token is ".1G")
更新:
所以我做了一些挖掘RVM脚本的工作,它完成了魔术,看起来这个错误来自脚本/usr/local/rvm/scripts/functions/utility
的这一部分(第416行):
__rvm_calculate_space_free()
{
# OpenBSD does not have 'df -m' param
__free_space="$( \command \df -Pk "$1" | __rvm_awk 'BEGIN{x=4} /Free/{x=3} $3=="Avail" {x=3} END{print $x}' )"
if [[ "${__free_space}" == *M ]]
then __free_space="${__free_space%M}" # some systems ignore -k and print M
else __free_space="$(( __free_space / 1024 ))"
fi
}
这是方式超出我的知识,但在我看来,报告的可用空间包括G
,它以某种方式混淆了操作,因此算术错误。
任何帮助表示感谢。
答案 0 :(得分:0)
您可以尝试以root身份安装它(所以使用' sudo rvm install 1.9.2')?
答案 1 :(得分:0)
解决方案是修改您的PATH变量,如:
$ echo $PATH
/home/ubuntu/.nvm/v0.10.30/bin:/usr/local/rvm/gems/ruby-2.1.1@rails4/bin:/usr/local/rvm/gems/ruby-2.1.1@global/bin:/usr/local/rvm/rubies/ruby-2.1.1/bin:/mnt/shared/bin:/home/ubuntu/workspace/node_modules/.bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/shared/sbin:/opt/gitl:/opt/go/bin:/mnt/shared/c9/app.nw/bin:/usr/local/rvm/bin
到
$ export PATH=/home/ubuntu/.nvm/v0.10.30/bin:/usr/local/rvm/gems/ruby-2.1.1@rails4/bin:/usr/local/rvm/gems/ruby-2.1.1@global/bin:/usr/local/rvm/rubies/ruby-2.1.1/bin:/home/ubuntu/workspace/node_modules/.bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/shared/sbin:/opt/gitl:/opt/go/bin:/mnt/shared/c9/app.nw/bin:/usr/local/rvm/bin:/mnt/shared/bin
注意/mnt/shared/bin
目录现在位于PATH变量的最后位置。