Hi,
to simply redirect all incoming input from STDIN to a file you can use less.
Create a shell script /tmp/stdinredirect.sh
1 2 | #!/bin/bash less <&0 >> /tmp/stdindata .txt |
This scripts appends all data from STDIN to the file /tmp/stdindata.txt
Set execute permissions and check
1 2 3 4 | michael@debedv ~ # chmod u+x /tmp/stdinredirect.sh michael@debedv ~ # echo Test STDIN | /tmp/stdinredirect.sh michael@debedv ~ # cat /tmp/stdindata.txt Test STDIN |
Michael