X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=.profile.d%2FTERM.bashrc;h=054e284b0ae2573ed4ad91c2f8d76db9460d4e05;hb=aca9a1b0a3f372cc385ff2dc7c4e0c4e392e89f7;hp=f9132c0cf0c2984d1659b3ac97346ffc2c12c26f;hpb=104b025d33b8cf5f9d42bda3ac3d158eb7a07701;p=profile.git diff --git a/.profile.d/TERM.bashrc b/.profile.d/TERM.bashrc index f9132c0..054e284 100644 --- a/.profile.d/TERM.bashrc +++ b/.profile.d/TERM.bashrc @@ -3,11 +3,27 @@ # Try to find a valid TERM entry. # -for term in linux dtterm xterm vt100; do - if has_term $term; then - export TERM=$term - break +# Note that running answerback will prevent keyboard input, which is annoying +# if you try to start typing while the shell is starting up. +term= +eval $(answerback 2>/dev/null) +case "$ANSWERBACK" in + PuTTY) term=xterm-256color;; + urxvt) term=rxvt-unicode;; +esac + +if [ ! -z "$term" ]; then + if ! has_term $term; then + export TERMINFO=~/.terminfo fi -done + export TERM=$term +elif ! has_term $TERM; then + for term in rxvt-unicode xterm-256color xterm-88color linux dtterm xterm-color xterm vt100; do + if has_term $term; then + export TERM=$term + break + fi + done +fi -unset term +unset ANSWERBACK term