a backticked command in Perl resp. Shell – what about $? ?

In the Shell $? reflects the exit code of the previously executed command.

h=$(ls foo) # supposing there is neither a file nor a directory by that name
echo "=$?=>{$?}"

In Perl $? reflects the exit code … as well:

$h = $(ls foo);
print "=$?={$?}n";

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.