I want to execute some remote command on my server using net-ssh library.
I have the following example:
Net::SSH::start(host, user, options = {:keys => '~/.ssh/id_rsa'}) do |ssh|
puts ssh.exec!("echo $PATH")
ssh.loop
end
The result is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
My problem is that I have not my PATH loaded as it should be.
I should also have some RVM paths, and custom paths defining into my .zshrc.
How could I change this behavior to let net-ssh to use my .zshrc to load my default environment ?
Solution:
puts ssh.exec!("source ~/.zshrc; echo $PATH")