[ Please don't use <pre>...</pre>. Use <p> at the start of paragraphs and use <c>...</c> around computer text (code, data, output, etc). ]
why the following two opens have different result?
is equivalent toopen(PS,"ls . 2>/dev/null |")
butopen(PS, '-|', /bin/sh', '-c', 'ls . 2>/dev/null ')
get optimised toopen(PS,"ls . |")
open(PS, '-|', 'ls', '.')
Also see the update to my original reply.
But how can i get the exit status for the command in this case?
You already know how. It's in $? after a successful close. In this case, it's 141. The shell returns 141 (128|SIGPIPE) when its child dies from SIGPIPE.
In reply to Re^3: How to know the status of a command invoked by open function?
by ikegami
in thread How to know the status of a command invoked by open function?
by zhujian0805
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |