-----BEGIN PGP SIGNED MESSAGE-----
I use nntpget command which comes with INN-1.5.1 for news article
sucking like the following. (actual script is more complex for the
error handling)
for i in $(cat /usr/lib/news/etc/subscriptions)
do
nntpget -t '970101 000000' -n comp.os.linux.misc news | inject.pl
if [ $? != 0 ]; then
cleanup
fi
done
Although when nntpget detects error it exits with exit(1), the
variable $? is always 0.
Q.1)
How can I get exit status of the command in the pipeline
from the shell?
Because I cannot find the solution, I tried to use the named pipe like
the following:
mkfifo /tmp/fifo$$
inject.pl < /tmp/fifo$$ &
for i in $(cat /usr/lib/news/etc/subscriptions)
do
nntpget -t '970101 000000' -n comp.os.linux.misc news > /tmp/fifo$$
if [ $? != 0 ]; then
cleanup
fi
done
This one seems to be able to detect the exit status of nntpget, but
frequently stop with unexpected exit status or seems deadlock.
Q.2)
I misunderstand the usage of the named pipe, or Linux named pipe is
broken?
If you write a followup, please CC: to my e-mail address too.
Here is my configuration:
Linux kernel-2.0.27
libc-5.4.17
bash-1.14.7
GNU fileutils 3.12
Thanks in advance.
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
iQCVAwUBMubpBEPp6IK9NdONAQGEXgQAr8iCMcZKI36N8g9wwhAigrdl8xWIR+jV
ILfmOKCy1jH8+rg0Xl/XqEZ62E/3CW66LK8E7k6Pig3HgQcZ+LmlRGcIBuTFGQi7
sdvNLDyY7ihjkxwONqtfzFuab2zJUDcf51iNAnhyh8c+g1lU7UkCLrlCnBKpByA6
o95l4+WFhwM=
=o57c
-----END PGP SIGNATURE-----