I have a bash script on a remote host that produces a large amount of data on fd = 3, as well as some possibly interesting data about stdout and stderr. I want to:
- Write stdout and stderr to a file on my local machine.
- Enter the data on fd = 3 into stdout on my local machine.
Here's how to do it if my big script was local:
exec 3> >(cat)
./big_script.sh -o /dev/fd/3 2>&1 >big_script.log
exec 3>&-
However, I want to run big_script.sh on a remote machine and all three channels (fd = 1, fd = 2 and fd = 3) exit the ssh program as separate ones. What is the best way to do this?
source
share