In article <mmedqv$hsu$
1...@news.m-online.net>,
What does that mean? The terminal is a possible *source* of input, not
the destination.
Background processes inherit stdin the same as foreground processes, so
the email process should get its stdin from the pipe. For instance:
echo hello | { sleep 5; cat; echo done; } &
The shell prompt comes back immediately, and 5 seconds later it prints
"hello" followed by "done".
The problem is related to the combination of "if" and backgrounding.
This works:
echo hello | if [ -z "$1" ]; then { sleep 5; cat; echo done; } ; fi
but this doesn't:
echo hello | if [ -z "$1" ]; then { sleep 5; cat; echo done; } & fi
After 5 seconds it prints "done", but not "hello".
If I change "cat" to "wc -l", it prints 1 in the non-if and foreground
versions, 0 in the if+background version.
--
Barry Margolin,
bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***