in reply to Re^3: How to know the status of a command invoked by open function?
in thread How to know the status of a command invoked by open function?

it's weird that i get return code '0' when i run my script on AIX.

  • Comment on Re^4: How to know the status of a command invoked by open function?

Replies are listed 'Best First'.
Re^5: How to know the status of a command invoked by open function?
by ikegami (Patriarch) on Aug 16, 2011 at 01:42 UTC

    Yes, very weird. You'd get zero if ls managed to finish before close closed the pipe, but that's not very likely. Or maybe AIX processes in general or AIX's ls specifically behave differently when they encounter a closed pipe. Or maybe the shell doesn't relay the death of the child to its parent in AIX.

    On AIX, what output do you get from

    /bin/sh -c 'perl -e'\''kill TERM => $$'\''' ; echo $?
      # /bin/sh -c 'perl -e'\''kill TERM => $$'\''' ; echo $? Terminated 143
        That rules out the last of the possibilities I listed.