0

I'm using net-ssh to connect to my server and need to run some ruby command.

The following doesn't work:

puts ssh.exec!("ruby -v")
bash: ruby: command not found

I always need to specify the full path:

puts ssh.exec!("/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby -v")

And it's like that for other command in general (rvm etc.)

Is there any option that would load the commands present in the bin folders?

Vincent Peres
  • 1,003
  • 1
  • 13
  • 28

1 Answers1

2

net-ssh and remote environment

you need to source .bashrc/.zshrc/ etc

ssh.exec!("source ~/.zshrc; /usr/bin/env ruby -v")

Community
  • 1
  • 1
sumskyi
  • 1,827
  • 13
  • 13