* Switch to a TERM that exists if the one we're using doesn't
authorDon Armstrong <don@donarmstrong.com>
Tue, 25 Sep 2007 05:42:01 +0000 (05:42 +0000)
committerDon Armstrong <don@donarmstrong.com>
Tue, 25 Sep 2007 05:42:01 +0000 (05:42 +0000)
.bashrc

diff --git a/.bashrc b/.bashrc
index e0af9c2..99e079c 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -35,6 +35,21 @@ if [ "$PS1" ]; then
     PS1="\[\033[0;36m\]\h \t \w$\[\033[0m\] "
     # \[\033[1;36m\][\w]\n\[\033[0;36m\][\h|\t]$ \[\033[0m\]
 
+    # make sure the term we're using exists in the termcap
+    if ! toe -a|grep -q "^$TERM        "; then
+       # if it doesn't, try to switch
+       case $TERM in
+           rxvt*)
+               TERM="rxvt"
+               ;;
+           xterm*)
+               TERM="xterm"
+               ;;
+           *)
+               ;;
+       esac
+       export TERM;
+    fi;
     # If this is an xterm set the title to user@host:dir
     case $TERM in
        screen|xterm*)