#!/bin/sh . ./vars SOCKDIR=$(mktemp -d) SOCKF=${SOCKDIR}/usock # Start tmux, if needed if ! tmux ls | grep -q rshsh; then tmux new -s rshsh -d fi # Create window tmux new-window -t rshsh "socat UNIX-LISTEN:${SOCKF},umask=0077 file:\$(tty),raw,echo=0" # Wait for socket while test ! -e ${SOCKF} ; do sleep 1 ; done # Use socat to ship data between the unix socket and STDIO. exec socat STDIO UNIX-CONNECT:${SOCKF}