Adding to the $PATH when sudoing
Normally to add to your
$PATH permenantly you do something like this:
export PATH=$PATH:/new/dir. You may notice though tht this doesn't always seem to work. Here's an example:
$ export PATH=$PATH:/home/sbrl/bin $ newcommand # works $ sudo bash # newcommand # works # exit $ sudo newcommand # doesn't work...wait what?
When a command is run with
sudo, it doesn't respect your existing
$PATH variable. To change it, you need to open the file
/etc/sudoers and add your path to the line that says something like
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin :/bin"
In order for your folder to be in your
$PATH when you use