Hi,

Within a function, I'd like to print some input to the terminal and at the same time 
store it in a fifo fostore some input in a fifo,  but am getting mixed results.  In this 
example, I thought "hello" would be output twice:

$>cmd_print () { mkfifo zout ; (tee zout &); cat zout ; rm zout; }
$>printf 'hello\n' | cmd_print

This outputs "hello" twice:

$>cmd_print () { mkfifo zout ; (cat - | tee zout &); cat zout ; rm zout; }
$>printf 'hello\n' | cmd_print
hello
hello

but this doesn't output anything:

$>cmd_print () { mkfifo zout ; (cat - | tee zout &) ; rm zout; }
$>cmd_print <<EOF
$> date
$> EOF

My real goal is to feed data to a function and then source it:
$> cmd_print () { mkfifo zout ; (cat - > zout ) & ; source zout ; rm zout; }
$> cmd_print <<EOF
$> date
$> EOF
$>

Could anyone please provide a few pointers on how to accomplish this, and 
perhaps explain the results from the above examples?



_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to