When I run echo $PATH as root from 2 different scenarios to the same server I get a different result.
Firstly I ssh via term as root where I installed kitchen. When I type
$ which kitchen
$ usr/local/rvm/gems/ruby-2.1.2/bin/kitchen
$ echo $PATH
I can see it correctly listed at the end
/usr/local/rvm/gems/ruby-2.1.2/bin:/usr/local/rvm/gems/ruby-2.1.2@global/bin:/usr/local
/rvm/rubies/ruby-2.1.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
/bin:/usr/games:/usr/local/games:/usr/local/rvm/bin:
/usr/local/rvm/gems/ruby-2.1.2/bin/kitchen
I'm using my assembla host to run the SSH script (also specifying root) and when I run
$ which kitchen
$ Process exited with: 1. Reason was: ()
$ echo $PATH
$ /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
/usr/games:/usr/local/games
Using Ubuntu 14.04
I would like to know how to get the same output when running from assembla account as when logged in over terminal if possible
Thanks,
This is most likely the difference between having an interactive shell and not having an interactive shell.
Different environment files will be read depending on your setup, take a look at your .bashrc or .profile
From the bash man page:
Bash attempts to determine when it is being run with its standard input connected to a a network connection, as if by the remote shell daemon, usually rshd, or the secure shell daemon sshd. If bash determines it is being run in this fashion, it reads and executes commands from ~/.bashrc, if that file exists and is readable.
Basically, run `grep -r kitchen ~/.*" to determine which file is adding kitchen to your PATH variable, then you will be able to determine if that file is being read when you ssh with a non-interactive terminal.
You can always set your PATH before you run your script as well:
export PATH=/usr/local/rvm/gems/ruby-2.1.2/bin/kitchen:${PATH}
P.S. in your output, it looks like your PATH variable has a newline in it, it should not.