1 man popen 可以看到 The return value from popen() is a normal standard I/O stream in all respects save that it must be closed with pclose() rather than fclose(3). Writing to
such a stream writes to the standard input of the command; the command's standard output is the same as that of the process that called popen(), unless this
is altered by the command itself. Conversely, reading from a "popened" stream reads the command's standard output, and the command's standard input is the
same as that of the process that called popen().
1 man popen
可以看到
The return value from popen() is a normal standard I/O stream in all respects save that it must be closed with pclose() rather than fclose(3). Writing to
也就是說,其回傳值是新進程的STDOUT ; 如果新的進程沒有在STDOUT 給予列印,你當然都不到;
2 在linutmint17 中執行
tshark -r t_fifo -T pdml
echo $?
為2;
說明命令不對,並且錯誤訊息被重定向到STDERR了;
如果你向在STDOUT 中獲得錯誤訊息,可以使用
tshark -r t_fifo -T pdml 2>&1