Talk:Shell Programming/I/O Redirection

additional examples using ssh
From http://unix.stackexchange.com/questions/226638/ssh-provide-additional-pipe-fds-in-addition-to-stdin-stdout-stderr

exec 5/tmp/out6 # pretend need 5 and 6
 * 1) !/bin/bash

ssh remote 'echo $$ >/tmp/pid; exec sleep 99999' <&5 >&6 & sleep 1 # hack. need /tmp/pid to be set

ssh remote ' pid=$(/proc/$pid/fd/1 echo start gzip -d <&5 | man /dev/stdin >&6 echo stop kill -hup $pid ' wait less /tmp/out6

-- Larsnooden (discuss • contribs) 18:35, 19 June 2016 (UTC)

example using read
$ cat let a b c d $ cat num 1 2 3 4 $ while read -u 3 a; read -u 4 b; do echo $a : $b; done 3< let 4< num; a : 1 b : 2 c : 3 d : 4

-- Larsnooden (discuss • contribs) 18:39, 19 June 2016 (UTC)