in reply to Backticks, $?, and Sudo
Answers:
Sudo should return the exit value of the command that was run.
A better example might be:$ sudo perl -e 'exit 3' $ echo $? 3
$ perl -le '`sudo perl -e "exit 3"`; print $?>>8' 3
Are you sure that is CHILD_ERROR you are looking at and not ERRNO? The reason I ask is twofold. The first is that $? should be numeric. The second is that I've often seen $! being set to "Illegal Seek" after a successful backtick command. I think it has to do with how perl implements the backticks. (Specifically, I think it attempts to do a seek on the pipe. I have no idea why though.) In any case, it doesn't much matter because $! isn't really applicable unless the return value extracted from $? is -1.
That depends...
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Backticks, $?, and Sudo
by ignatz (Vicar) on Jan 17, 2003 at 18:12 UTC | |
by sauoq (Abbot) on Jan 17, 2003 at 18:34 UTC | |
by ignatz (Vicar) on Jan 17, 2003 at 21:14 UTC | |
by sauoq (Abbot) on Jan 17, 2003 at 21:26 UTC |