changeset 326:b27e43878127

[rc/bash] Better test for Solaris environment.
author Edho Arief <edho@myconan.net>
date Sun, 18 Mar 2012 16:24:28 +0700
parents 795ad57794a6
children 936adea50fde aeb51856e281
files rc/bash
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/rc/bash	Sun Mar 18 16:02:08 2012 +0700
+++ b/rc/bash	Sun Mar 18 16:24:28 2012 +0700
@@ -61,12 +61,21 @@
     # Hello tmux. Perhaps one day we'll have title with dtterm.
     # But for now we work this around by prepending tmux call with xterm-256color
     # which hopefully exists. Otherwise we have to live with no title.
-    if [ -f /usr/share/lib/terminfo/x/xterm-256color ]; then
-      alias tmux="TERM=xterm-256color tmux"
-    else
-      echo "No xterm-256color terminal, using dtterm. Tmux title won't work."
-    fi
-    [ -f /usr/share/lib/terminfo/?/"${TERM}" ] || export TERM=dtterm
+    [ -f "/usr/share/lib/terminfo/x/xterm-256color" ] && has_xterm256c=y
+    [ -f "/usr/share/lib/terminfo/s/screen" ] && has_screen=y
+    case "${TERM}" in
+      xterm*)
+        if [ -f "/usr/share/lib/terminfo/x/xterm-256color" ]; then
+          export TERM="xterm-256color"
+        else
+          echo "No xterm-256color terminal, using dtterm. Tmux title won't work."
+          export TERM="dtterm"
+        fi
+      ;;
+      screen)
+        [ -f "/usr/share/lib/terminfo/s/screen" ] || export TERM="dtterm"
+      ;;
+    esac
     if command -v ggrep > /dev/null 2>&1; then
       _has_gnu_grep=y
       _grep="ggrep"