How can I check the status of the first program in pipeline in Perl's system()?

后端 未结 7 535
小蘑菇
小蘑菇 2021-01-21 06:41
perl -e \'system (\"crontab1 -l\");print $?\'

returns -1 as expected (program crontab1 doesn\'t exist)

perl -e \'system (\"crontab1 -l|         


        
7条回答
  •  时光说笑
    2021-01-21 07:24

    If you tolerate using something other than system, there are easier solutions. For example, the results method in IPC::Run returns all exit codes of the chain.

提交回复
热议问题