]> git.donarmstrong.com Git - home-base.git/commitdiff
properly select xterm if stterm isn't in termcap
authorDon Armstrong <don@donarmstrong.com>
Fri, 30 Jun 2017 19:32:14 +0000 (12:32 -0700)
committerDon Armstrong <don@donarmstrong.com>
Fri, 30 Jun 2017 19:32:14 +0000 (12:32 -0700)
.bashrc

diff --git a/.bashrc b/.bashrc
index 37b7c82c08b43c2860d7594bbee44c2e4b4e39cf..0773f1d0e3bbcb825f1fdcbc7a7ed4ff8cf9e9ac 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -65,27 +65,21 @@ if [ "$PS1" ]; then
     # \[\033[1;36m\][\w]\n\[\033[0;36m\][\h|\t]$ \[\033[0m\]
 
     # make sure the term we're using exists in the termcap
-    TOEOPT='-a'
-    if ! toe $TOEOPT >/dev/null 2>&1; then
-       TOEOPT=''
+    if [[ "$TERM" =~ "rxvt-" ]] && which tput >/dev/null 2>&1; then
+        if [[ -z "$(tput longname 2>/dev/null)" ]]; then
+            TERM="xterm-${TERM##rxvt-}"
+            export TERM
+        fi;
     fi;
-    if ! toe $TOEOPT|grep -q "^$TERM   "; then
-       # if it doesn't, try to switch
-       case $TERM in
-           rxvt*)
-               TERM="rxvt"
-               ;;
-           xterm*)
-               TERM="xterm"
-               ;;
-           *)
-               ;;
-       esac
-       export TERM;
+    if [[ "$TERM" =~ "stterm-" ]] && which tput >/dev/null 2>&1; then
+        if [[ -z "$(tput longname 2>/dev/null)" ]]; then
+            TERM="xterm-${TERM##stterm-}"
+            export TERM
+        fi;
     fi;
     # If this is an xterm set the title to user@host:dir
     case $TERM in
-       screen|xterm*)
+       screen|xterm*|stterm*)
             PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
             ;;
        rxvt*)