#!/bin/bash [ -z "$2" ] && echo "usage: $0 []" && exit 1 TTY=$1 BAUD=$2 shift shift # Ensure some kind of mutial exclusion. if lsof $TTY; then echo "$TTY in use" exit 1 fi TARGET_TTY=$TTY,b$BAUD,raw,echo=0 # treat console end as a terminal. run this in an xterm or emacs # terminal emulator. CONSOLE_TTY=`tty`,raw,echo=0 # give the argument "-" to run without console special keys, i.e. in # an emacs shell buffer. [ -z "$1" ] || CONSOLE_TTY=$1 echo "Connecting $TARGET_TTY to $CONSOLE_TTY" exec socat $TARGET_TTY $CONSOLE_TTY echo Failed.