X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/blobdiff_plain/f668482fe8b6724f56525bda48fc8d40e2041d83..a10bf242a684d2dd8cdd2fe949330a21cdb7789e:/bin/xremote diff --git a/bin/xremote b/bin/xremote new file mode 100755 index 0000000..9aefdb9 --- /dev/null +++ b/bin/xremote @@ -0,0 +1,16 @@ +#! /bin/sh -e + +case $#,$1 in + 0,* | 1,*) ok=nil ;; + *,*:*) ok=t ;; + *) ok=nil ;; +esac +case $ok in + nil) echo >&2 "usage: $0 HOST:RDPY/LDPY PROG ARGS ..."; exit 2 ;; +esac +host=${1%:*} dpy=${1##*:}; rdpy=${dpy%%/*} ldpy=${dpy#*/}; shift 1 + +ssh -L"/tmp/.X11-unix/X$ldpy:/tmp/.X11-unix/X$rdpy" -Nafx "$host" +sleep 1 +trap 'trap - INT QUIT HUP EXIT; ssh -Oexit "$host"; rm -f "/tmp/.X11-unix/X$ldpy"' INT QUIT HUP EXIT +DISPLAY=:$ldpy "$@"