I installed arm-linux-g++ and added its directory to PATH and it recognizes the command. But when I try it with sudo it says command not found. I even tried adding its directory to bashrc--root but still nothing changed. How can I fix it?
1 Answer
sudo specifically ignores your PATH variable and uses its own. Compare echo "$PATH"
with sudo sh -c 'echo "$PATH"'
. Either put the command in one of the paths sudo trusts, or supply the full path to that particular command.
-
you're right it's not in sudo PATH. How can i add it to one of those paths you mentioned? Jun 4, 2013 at 8:29
-
@soroosh.strife for instance
sudo cp /path/to/the/command /usr/local/bin/
.– geirhaJun 4, 2013 at 9:49 -
@geirha Wouldn't
ln -s
be better (as any updates to the command woundn't be reflected if you copy it) , or even fixing the path for sudo?– demureJun 4, 2013 at 12:14