I have an executable script install_packages.sh
in /home/etienne/admin
folder. The directory's path is added to $PATH
variable from /etc/bash.bashrc
. When I type #echo $PATH
I see that the variable does contain the directory's path. However, when I try to run the script from other directories, shell says that command not found
. From within own directory, the script runs fine if call it as ./install_packages.sh
. The script itself is ordinary - it contains only apt-get install <package>
lines. I am really baffled
Output of the echo $PATH | xxd
0000000: 2f68 6f6d 652f 6461 6e69 656c 2f61 646d /home/etienne/adm
0000010: 696e 3a2f 7573 722f 6c6f 6361 6c2f 7362 in:/usr/local/sb
0000020: 696e 3a2f 7573 722f 6c6f 6361 6c2f 6269 in:/usr/local/bi
0000030: 6e3a 2f75 7372 2f73 6269 6e3a 2f75 7372 n:/usr/sbin:/usr
0000040: 2f62 696e 3a2f 7362 696e 3a2f 6269 6e3a /bin:/sbin:/bin:
0000050: 2f75 7372 2f67 616d 6573 3a2f 7573 722f /usr/games:/usr/
0000060: 6c6f 6361 6c2f 6761 6d65 730a local/games.
echo "$PATH" | xxd
to the question. Also, check that the error isn't coming from inside of the script: doesn't it call a command that's not found? – choroba Apr 08 '15 at 09:06apt-get install
lines. If I run them from the shell they work – Etienne Kahn Apr 08 '15 at 09:14./install_packages.sh
? – heemayl Apr 08 '15 at 09:40hash -r
? – choroba Apr 08 '15 at 09:58# echo $PATH
, does that mean you are logged in as root? Are you runningecho $PATH
andinstall_packages.sh
as the same user? Is either of the commands run withsudo
? – terdon Apr 08 '15 at 09:59/home/etienne/admin/install_packages.sh
? And do you have the full error message the shell complains? Sometimes the script may try to call itself with./install_packages.sh
. – user23013 Apr 08 '15 at 11:04/home.etienne/bin
? Does it work then? – Fabby Apr 12 '15 at 10:13