#!/usr/bin/env bash #:~/bin/my-title # # set window title (in xterm or screen terminal) if [ "$1" = "" ]; then t="`dirs`" else t="$1" fi case $TERM in xterm*) echo -en "\033];`whoami`@`hostname -s`: $t\007" ;; screen*) echo -en "\033k" # 1=login shell, 2=this script run (not sourced) from it if [ "$SHLVL" -le 2 ]; then # if the shell is a login shell, screen must be # running on a different machine - include hostname: echo -en "`hostname -s`:" fi echo -en "$t\033\134" ;; esac