views:

140

answers:

2

I added

export PATH="/home/deltrem/Pedro - Arquivos/play/ps1/linux/pSX:$PATH"

to

/root/.bashrc

, but

sudo pSX

echoes

command not found.

A: 

Is pSX a directory, a file, or both (a directory called pSX containing a file named pSX)? If it's a directory, you need to enter the actual command name instead. If it's a file (but not a directory) then you need to remove the /pSX from the PATH variable.

Does pSX have the executable bit set? The OS might not know that pSX is a command.

Benjamin Geiger
a directory (pSX) containing a file (pSX too) and pSX (the file) has the executable bit set
Delirium tremens
+2  A: 

Are you logging in as root? If so, then you have no need for sudo.

If not, then the contents of /root/.bashrc won't matter, since the sudo command gets its path from the environment in which it's run. In other words, it copies your user-level path. Instead, edit the path in your user's .bashrc.

Benjamin Geiger
I'm logged in as deltrem, but need temporary root access.
Delirium tremens
That's what the `sudo` command does. However, it doesn't run the `/root/.bashrc` script, or any other scripts in root's home directory.Basically, the path needs to contain the pSX directory before you run `sudo`. The easiest way to do this is to edit your user's `.bashrc` file, then run `. ~/.bashrc` (or log out and back in).
Benjamin Geiger
Have you tried giving sudo the full path to the pSX executable?
Benjamin Geiger
The full path to pSX (the file) worked. `. ~/.bashrc`, then `sudo pSX` didn't work and `sudo . ~/.bashrc`, then `sudo pSX` didn't work.
Delirium tremens
Did you add the `export PATH` line in your post to your user's .bashrc?
Benjamin Geiger