From: Don Armstrong Date: Fri, 30 Jun 2017 19:32:14 +0000 (-0700) Subject: properly select xterm if stterm isn't in termcap X-Git-Url: https://git.donarmstrong.com/?p=home-base.git;a=commitdiff_plain;h=a165a87dbbc06fbd27d1311649a02728f999cae1 properly select xterm if stterm isn't in termcap --- diff --git a/.bashrc b/.bashrc index 37b7c82..0773f1d 100644 --- 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*)