#!/usr/bin/env etsh : : etsh - " Force sh(1), csh(1), and other shells to exit w/ error! " <'' ;;; : : " @(#)$Id: 468c5e993c75f7aac612917b72cc7ca59f56763f $ " : : " The author of this file, J.A. Neitzel , " : " hereby grants it to the public domain. " : : : " Set the window title for terminal emulators under X. " : : " usage: xtitle [string] " : : " Check for correct usage. " : >>$0'' <'' ; : >>$1'' <'' killer $0 xtitle if $# != 0 -a $# != 1 if { exit } pusage $0 '"[string]"' ( : " Fail if this process does not have a controlling terminal. " ) >/dev/tty : : " Exit quietly w/ a non-zero status if the value of TERM does not match " : " the following pattern. Change the pattern according to your needs. " : printenv TERM | egrep '^(rxvt|rxvt-unicode|rxvt-unicode-256color|screen|xterm|xterm-color)$' >/dev/null if $? != 0 if { exit } false : : " If $1 is specified, set the window title to the specified value. " : if $# = 1 if { exit } printf "%b" '\033]0;'$1'\007' >/dev/tty : : " Otherwise, set it to a nice default value... " : ( \ printf "%b" '\033]0;' ; \ printf "%b" $u'@' ; printenv HOST ; \ printf "%b" ':' ; printenv TTY | cut -d/ -f3- | sed 's,tty,,' ; \ printf "%b" '\007' ; \ ) | tr -d '\n' >/dev/tty