1

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.
  • Please, add the output of 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 8 '15 at 9:06
  • At the moment script contains only apt-get install lines. If I run them from the shell they work – Etienne Kahn Apr 8 '15 at 9:14
  • Do you get any error while running like ./install_packages.sh ? – heemayl Apr 8 '15 at 9:40
  • No at all. That's what frustrates me. – Etienne Kahn Apr 8 '15 at 9:43
  • 1
    You mention you run # echo $PATH, does that mean you are logged in as root? Are you running echo $PATH and install_packages.sh as the same user? Is either of the commands run with sudo? – terdon Apr 8 '15 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.