How to access commands in bin folder through ruby net-ssh?
Question
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?
Solution
net-ssh and remote environment
you need to source .bashrc/.zshrc/ etc
ssh.exec!("source ~/.zshrc; /usr/bin/env ruby -v")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow