1

I added

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

to

/root/.bashrc

, but

sudo pSX

echoes

command not found.

Delirium tremens
  • 4,623
  • 9
  • 46
  • 59

3 Answers3

1

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.

  • I'm logged in as deltrem, but need temporary root access. – Delirium tremens Apr 26 '10 at 21:43
  • 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 Apr 26 '10 at 21:46
  • 1
    Have you tried giving sudo the full path to the pSX executable? – Benjamin Geiger Apr 26 '10 at 21:47
  • 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 Apr 26 '10 at 22:00
  • Did you add the `export PATH` line in your post to your user's .bashrc? – Benjamin Geiger Apr 26 '10 at 22:26
  • It's best to modify your $PATH in .bash_profile instead of .bashrc. You don't want to have duplicate entries in $PATH for each level of sub-shells you run. – graywh Nov 04 '10 at 18:14
0

After spending the past hour banging my head against the wall, I finally figured out how to do this. It has nothing to do with bashrc, profile, or environment. Instead open up /etc/sudoers and change secure_path.

flumpb
  • 1,707
  • 3
  • 16
  • 33
0

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.