Populate titlebar in any term
1 2 #!/bin/bash 3 HOST_NAME=`hostname -f` 4 if [ `id -u` = 0 ]; then 5 OPT=”`uname` (`uname -a | cut -f12 -d’ ‘ -`) - ROOT USER” 6 else 7 OPT=”`uname` (`uname -a | cut -f12 -d’ ‘ -`)” 8 fi 9 REPLACE=”${HOST_NAME} - ${OPT}” 10 echo -n -e “\033]0; $REPLACE \007 “ 11 echo “${REPLACE}” 12 exit 0
Then run this script, and your termtitle will be something like the following:
1 2 Servername (Linux / x86_64).
For Solaris it needs to be done a bit differently:
1 2 #!/usr/local/bin/bash 3 HOST_NAME=`uname -a | cut -f2 -d’ ‘ -` 4 OPT=”(`uname -a | cut -f1 -d’ ‘ -` / `uname -a | cut -f6 -d’ ‘`)” 5 REPLACE=”${HOST_NAME} - ${OPT}” 6 echo -n -e “\033]0; $REPLACE \007 “ 7 echo “${REPLACE}” 8 exit 0
Add/remove things from the OPT= line to customize. To test it, just issue the command on the commandline without the ()'s to see what it'll look like.