small pixel drawing of a pufferfish dotfiles

bin/MACC02VK5ECHTD7/jws-ssh

#!/bin/sh
#
# input: us-east-1a      172.29.71.236   i-0a7eb3896d61b4d22     Krakencld-app-ASG-A     running m5.large        None    browse_test

# if > 1 argument: run the given command on each remote system and stream the output
if ! [ -z "$1" ]; then
	echo "establishing connections..."
	while IFS='$\n' read -r i; do
		echo $i
		ip=$(echo "$i" | awk '{print $2}')
		ssh "$ip" "$1"
	done
	exit 0
fi

# if no arguments: opens tmux panes to every remote host in list via ssh, sync panes
tmux set default-shell "/bin/sh"
tmux new-window 'sleep 0.1'
while IFS='$\n' read -r i; do
	ip=$(echo "$i" | awk '{print $2}')
	tmux split-window "ssh $ip"
	tmux select-layout tiled
done
tmux set -u default-shell
tmux select-layout tiled
tmux setw synchronize-panes on