#!/bin/sh # Sets up X authority stuff on remote hosts XAUTH=/usr/X11R6/bin/xauth myhost=sm5sxl.net cookie=$($XAUTH list | grep '/unix:0.*MAGIC' | uniq -f1 | nawk '{print $3}') for host in "$@"; do ssh ${host} "rm -f ~/.Xauthority; \ $XAUTH add ${myhost}:0 . $cookie; \ $XAUTH add :63 . $cookie" done .