#!/bin/sh ######################################################################### # # FILE : display # DATE : 30.8.2000 # AUTHOR : Patrick Meier / patrick.meier@gmx.net # DESCRIPTION : set the display variable correct # # Copyrigth (C) 2001 by Patrick Meier, Switzerland # ######################################################################### PN=`basename "$0"` ######################################################################### # Usage ######################################################################### Usage() { echo "$PN - set the display variable correct" echo "usage: $PN" exit 1 } ######################################################################### # main ######################################################################### while [ $# -gt 0 ] do case "$1" in --help) Usage; exit 1;; -h) Usage; exit 1;; *) break;; esac shift done localhost=`hostname` whooutput=`who -m\ | sed 's/(//g;s/)//g;s/pts\///g' \ | awk '{ if(length($6)>0) { print $6 } }'` if [ -n "$whooutput" ] then echo "You are logged in from $whooutput" else echo "You are logged in from local terminal" fi DISPLAY="$whooutput:0.0" export DISPLAY ######################################################################### # EOF #########################################################################