This is a great way to really get to know mkfifo and tee. After you make a named pipe with mkfifo, you must connect the pipe to an output before you can connect it to an input. The & at the end of the line makes the script keep going while the spawned subtask is running.
This is the hard way to do this. There is a program called script that is supposed to be able to capture all input and output in a spawned sub-shell. And it is easy to run a script and capture the output:
# sh script.sh 2>&1 | tee logfile
The above example is for situations where you want to be able to do these kinds of dynamic plumping redirections from within a script, operating at the current shell level.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum