+ -
当前位置:首页 → 问答吧 → 杯具,踩中地雷,光荣牺牲。。。。。

杯具,踩中地雷,光荣牺牲。。。。。

时间:2011-07-04

来源:互联网

  1. [etl@dmtest ]$ cat a.pl
  2. exit  system("perl b.pl");
  3. [etl@dmtest ]$ cat b.pl
  4. print "22\n";
  5. exit 45;
复制代码
所以杯具鸟。。。
  1. [etl@dmtest ]$ perl a.pl
  2. 22
  3. [etl@dmtest ]$ echo $?
  4. 0
复制代码
必须是:
  1. [etl@dmtest ]$ cat a.pl
  2. exit  system("perl b.pl")>>8;
  3. [etl@dmtest ]$ perl a.pl
  4. 22
  5. [etl@dmtest ]$ echo $?
  6. 45
复制代码
这个才能得到正确的返回值。。。。。

作者: toniz   发布时间: 2011-07-04

8是。。

作者: 章北海   发布时间: 2011-07-04