4 usage () { echo "usage: $0 [-ensw] HOST:RDPY/LDPY"; }
5 while getopts "hensw" opt; do
15 shift $(( $OPTIND - 1))
16 case $bogus,$#,$1 in nil,1,*:*/*) ;; *) usage >&2; exit 2 ;; esac
17 host=${1%:*} dpy=${1##*:}; rdpy=${dpy%%/*} ldpy=${dpy#*/}
18 control=ControlPath=~/.ssh/sock-%l/control-%r@%h.x2x
19 ssh -o$control -L"/tmp/.X11-unix/X$ldpy:/tmp/.X11-unix/X$rdpy" -Nafx "$host"
21 trap 'trap - INT QUIT HUP EXIT; ssh -o$control -Oexit "$host"; rm -f "/tmp/.X11-unix/X$ldpy"' INT QUIT HUP EXIT
22 x2x -$dir -to ":$ldpy"