Fwd: Re: exit code ?
Todd C. Miller
Todd.Miller at courtesan.com
Tue Mar 28 10:49:44 EST 2000
In message <20000328141559.21300.qmail at web204.mail.yahoo.com>
so spake George Meharry II (gmeharry):
> I think the question is how to get the $status from
> the command sudo executed.
It's still just $status or $? depending on the shell. Since
sudo execs the program to run you get the program's exit value,
not sudo's (when you exec something the program that is execed
overwrites the other process). The only reason you would get
sudo's exit value would be if there was an error (like it the
program to exec wasn't found).
xerxes [~] % sudo true; echo $status
xerxes [~] % sudo false ; echo $status
xerxes [~] % sudo does_not_exist ; echo $status
sudo: does_not_exist: command not found
More information about the sudo-users