Shell script allow multiple file descriptors (up to 9 for POSIX compliance, but even more for bash):
$ install -m 755 /dev/stdin /tmp/test <<\EOF
#!/bin/sh
echo hi1 >&1
echo hi2 >&2
echo hi3 >&3
echo hi4 >&4
EOF
$ /tmp/test 1> /tmp/1 2> /tmp/2 3> /tmp/3 4> /tmp/4
$ cat /tmp/1
hi1
$ cat /tmp/2
hi2
$ cat /tmp/3
hi3
$ cat /tmp/4
hi4
I want to achieve the same behaviour over SSH, but what happens is:
$ ssh user@remote_machine /tmp/test 1> /tmp/1 2> /tmp/2 3> /tmp/3 4> /tmp/4
$ cat /tmp/1
hi1
$ cat /tmp/2
hi2
/tmp/test: 5: /tmp/test: 3: Bad file descriptor
/tmp/test: 6: /tmp/test: 4: Bad file descriptor
$ cat /tmp/3
$ cat /tmp/4
Is it possible to have multiples output pipes over SSH other than stdout and stderr?
It is important to note I am not looking for port forwarding, since I will have network issues.