#!/bin/bash #Copyright 2002, William Stearns #Released under the GPL #V0.5 FanSetupCleanup () { for OnePipe in $InPipes $OutPipes; do if [ -p "$OnePipe" ]; then rm -f "$OnePipe" fi done } if ! type -path mktemp >/dev/null 2>/dev/null ; then echo "Sorry, no mktemp utility, exiting." >&2 exit 1 fi if [ -z "$1" ]; then echo Usage: >&2 echo "$0 ssh_host [ssh_host]..." >&2 exit 1 fi for OneHost in "$@" ; do InPipe=`mktemp -q -u /tmp/fanout.XXXXXX` if [ $? -ne 0 ]; then echo "$0: Can't create temp file $InPipe." >&2 exit 1 fi mknod $InPipe p OutPipe=`mktemp -q -u /tmp/fanout.XXXXXX` if [ $? -ne 0 ]; then echo "$0: Can't create temp file $OutPipe." >&2 exit 1 fi mknod $OutPipe p InPipes="$InPipes $InPipe" OutPipes="$OutPipes $OutPipe" cat $InPipe | ssh "$OneHost" >$OutPipe 2>&1 & xterm -T "$OneHost" -n "$OneHost" -e cat $OutPipe & done fanterm $InPipes wait FanSetupCleanup