I'm a script kiddie of sorts and enjoy writing bash scripts for things, and I keep them in a repository that I synchronize, and on my personal computers I keep it in a home/otherStuff/customBin folder, but...
while I can add it to the .bashrc of every profile that gets tedious, and etc/environment doesn't seem to work for one reason or another.
(Edit) @steeldriver answered the below portion, but I still need the above question answered.
And the crux of the problem was, when I did "sudo customScript" it behaves like the file isn't on path, but doing "sudo -i" and then "customScript" does work just fine. How do I fix it?
"Under the default Ubuntu configuration, sudo uses its own secure_path in place of the environment's PATH - see for example Executable runs without sudo but not with sudo" – steeldriver
sudo
uses its ownsecure_path
in place of the environment'sPATH
- see for example Executable runs without sudo but not with sudosudo -l
you will likely see thatsecure_path
contains both/usr/local/sbin
and/usr/local/bin