我在 Ubuntu 12.04 机器上。有一个脚本文件,在终端中手动输入时运行
gnome-terminal -e /home/precise/Desktop/cartodb/script.sh
脚本文件的内容是
cd /home/ubuntupc/Desktop/cartodb20/
sh /home/ubuntupc/.rvm/scripts/rvm
bundle exec foreman start -p 3000
所以我尝试在每次系统启动时运行这个脚本。所以在启动应用程序
command: gnome-terminal -e /home/precise/Desktop/cartodb/script.sh
在终端上编辑 -> 配置文件首选项 -> 标题和命令
Checked the "Run command as a login shell"
但这似乎不起作用。重新启动机器时,在终端中发现这些错误
The child process exited normally with status 127.
ERROR: RVM Ruby not used, run `rvm use ruby` first.
有关已安装的软件包和系统的一些信息。
$ 哪个红宝石
/home/ubuntupc/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
$ 哪个轨道
/home/ubuntupc/.rvm/gems/ruby-1.9.2-p320/bin/rails
$ 哪颗宝石
/home/ubuntupc/.rvm/rubies/ruby-1.9.2-p320/bin/gem
$ cat ~/.bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
$ which -a ruby
/home/ubuntupc/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
$ sudo 更新替代方案 --config ruby
update-alternatives: error: no alternatives for ruby.
$ sudo find /-name“rubygems”-print
/home/ubuntupc/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems
/home/ubuntupc/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rubygems
/home/ubuntupc/.rvm/src/ruby-1.9.2-p320/lib/rubygems
/home/ubuntupc/.rvm/src/ruby-1.9.2-p320/test/rubygems
/home/ubuntupc/.rvm/src/ruby-1.9.2-p320/test/rubygems/rubygems
/home/ubuntupc/.rvm/src/ruby-1.9.2-p320/doc/rubygems
/home/ubuntupc/.rvm/src/rubygems-2.2.1/lib/rubygems
/home/ubuntupc/.rvm/src/rubygems-2.2.1/test/rubygems
/home/ubuntupc/.rvm/src/rubygems-2.2.1/test/rubygems/rubygems
/home/ubuntupc/.rvm/src/rvm/scripts/functions/rubygems
/home/ubuntupc/.rvm/src/rvm/scripts/rubygems
/home/ubuntupc/.rvm/scripts/functions/rubygems
/home/ubuntupc/.rvm/scripts/rubygems
/usr/lib/ruby/1.9.1/rubygems
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rubygems
/usr/local/rvm/src/ruby-1.9.2-p320/lib/rubygems
/usr/local/rvm/src/ruby-1.9.2-p320/test/rubygems
/usr/local/rvm/src/ruby-1.9.2-p320/test/rubygems/rubygems
/usr/local/rvm/src/ruby-1.9.2-p320/doc/rubygems
/usr/local/rvm/src/rubygems-2.2.0/lib/rubygems
/usr/local/rvm/src/rubygems-2.2.0/test/rubygems
/usr/local/rvm/src/rubygems-2.2.0/test/rubygems/rubygems
/usr/local/rvm/src/rvm/scripts/functions/rubygems
/usr/local/rvm/src/rvm/scripts/rubygems
/usr/local/rvm/scripts/functions/rubygems
/usr/local/rvm/scripts/rubygems
由于我是 Ruby 应用程序的新手,请指出我遗漏了什么。
提前致谢
答案1
你的代码确实
sh /home/ubuntupc/.rvm/scripts/rvm
这将运行 rvm 而不带任何参数。您实际上想要做的是将 rvm 代码包含在当前脚本中,因此将该行替换为
source $HOME/.rvm/scripts/rvm