in reply to Re^3: Running a C program from Perl
in thread Running a C program from Perl
I think it looks like I and to some extent you, are barking up the wrong tree (well on linux & AIX anyway) - consider the following behaviour exhibited by both Linux 2.6.28-11-generic and AIX 5.3:
Personally, I would expect the one-liner to print bash: egrepa: command not found - as it does if entered from command line - but doesn't.user@unforgiven:~$ egrepa bash: egrepa: command not found user@unforgiven:~$ egrepa >/dev/null bash: egrepa: command not found user@unforgiven:~$ egrepa >/dev/null 2>&1 user@unforgiven:~$ perl -e '$res = `egrepa 2>&1`; print $res' user@unforgiven:~$
If, however, as you suggest, a valid command is used with invalid opts, then the re-direction works as expected and the error is seen (on both platforms).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Running a C program from Perl
by ikegami (Patriarch) on May 27, 2009 at 13:45 UTC |