Perl-Sensitive Sunglasses | |
PerlMonks |
getting the bash exit codeby xorl (Deacon) |
on Aug 24, 2012 at 18:45 UTC ( [id://989610]=perlquestion: print w/replies, xml ) | Need Help?? |
xorl has asked for the wisdom of the Perl Monks concerning the following question: Yes there are a number of posts and sites that talk about using perl to run other scripts and to get the exit status. However I haven't seen any that explain the behavior I'm seeing and I'm just plain confused. I have a bash script prints out some stuff and then at the end does an "exit 101". I want my perl script to capture both the content of what the script prints and the 101 value of the exit code. So of course I tried:
my_perl_script.pl Running my_perl_script.pl results in: Content: foo Exit Code: 25856 Now I have no idea how it got 25856 from 101 (well it does seem to be 101 times that magical 256 number, but I'm sure it isn't that simple). In bash if I run myscript.sh and echo $? I get the expected 101. So something weird I think is happening with the backticks.
Back to
Seekers of Perl Wisdom
|
|