[mca1001] / bin / location  

mca1001: bin/location

File: [mca1001] / bin / location (download)
Revision: 1.7, Mon Jul 31 17:53:04 2006 UTC (4 years, 1 month ago) by mca1001
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +3 -1 lines
comment

#! /bin/sh

# $Id: location,v 1.7 2006/07/31 17:53:04 mca1001 Exp $
# See $PROMPT_COMMAND under bash on a Red Hat box

# Exit unless we like the terminal we're running in
### (odd, deskpro redhat xterms and gnome-terminals claim to be vt100)
if [ $TERM != "xterm" ] && [ $TERM != "vt100" ]; then
    echo "Don't like TERM=$TERM"
    exit 1
fi


USER=`id -un`
HOST=`hostname`

# Tru64 doesn't like this
if [ "$BASH_VERSION" != "" ]; then
  HOST=${HOST%%.*}
fi

TTY=`tty | sed 's@/dev/@@'`

if [ "$USER" == "mca1001" ] || [ "$USER" == "matthew" ] || [ "$USER" == "mca" ]; then
  USER=""
elif [ "$USER" == "root" ]; then
  USER="R@"
else
  USER="$USER@"
fi

if [ "$*" == "" ]; then
  ARGS="$USER$HOST:$TTY"
else
  ARGS="$*"
fi

/bin/echo -ne "\033]0;$ARGS\007"
#                   ^ was 2.
# Could bother to look up the difference but didn't.
# 2 seems to set window title but not window-list title.
# 0 seems to set both.

# Tru64 /bin/echo groksn't -e but doesn't need it; claims to only understand -n when CMD_ENV=bsd

Repository owner

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help