changeset 268:feab84a8efdb

Merge. Also more workaround for Solaris tmux.
author Edho Arief <edho@myconan.net>
date Thu, 24 Nov 2011 13:52:07 +0700
parents 20ff9a9d11f0 (current diff) e35a36bb832e (diff)
children cd48b7a5cddd
files rc/bash
diffstat 1 files changed, 13 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/rc/bash	Thu Nov 24 13:28:13 2011 +0700
+++ b/rc/bash	Thu Nov 24 13:52:07 2011 +0700
@@ -24,7 +24,8 @@
 export PAGER="less -Rins"
 export EDITOR=vi
 export LANG="en_US.UTF-8"
-unset LS_COLORS
+export CLICOLOR=
+export LSCOLORS=ExGxFxdxCxegedabagExEx
 
 alias less="less -Rins"
 #assuming POSIX grep
@@ -34,18 +35,15 @@
 alias rm="rm -i"
 alias rd="rdesktop -g 1280x600 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
 
-_has_rm_I=
 _has_gnu_ls=
 _has_gnu_grep=
 _ls="ls"
 case "$(uname -s)" in
   Linux)
-    _has_rm_I=y
     _has_gnu_ls=y
     _has_gnu_grep=y
   ;;
   SunOS)
-    [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
     [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y
     [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y
     # Higher priority directories
@@ -58,14 +56,14 @@
     alias ping="ping -s"
     alias ping6="ping -A inet6"
     # Hello tmux. Perhaps one day we'll have title with dtterm.
-    # But for now we work this around by prepending tmux call with xtermc.
-    alias tmux="TERM=xtermc tmux"
-    [ -f "/usr/share/lib/terminfo/?/${TERM}" ] || export TERM=dtterm
-  ;;
-  FreeBSD)
-    _has_rm_I=y
-    export CLICOLOR=
-    export LSCOLORS=ExGxFxdxCxegedabagExEx
+    # 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, using dtterm. Tmux title won't work."
+    fi
+    [ -f /usr/share/lib/terminfo/?/"${TERM}" ] || export TERM=dtterm
   ;;
   OpenBSD)
     PATH="${PATH}:/usr/X11R6/bin"
@@ -73,8 +71,6 @@
       _has_gnu_ls=y
       _ls="gls"
     elif command -v colorls > /dev/null 2>&1; then
-      export CLICOLOR=
-      export LSCOLORS=ExGxFxdxCxegedabagExEx
       alias ls='colorls -F'
     fi
   ;;
@@ -84,8 +80,6 @@
       _has_gnu_ls=y
       _ls="gls"
     elif command -v colorls > /dev/null 2>&1; then
-      export CLICOLOR=
-      export LSCOLORS=ExGxFxdxCxegedabagExEx
       alias ls='colorls -F'
     fi
   ;;
@@ -94,11 +88,9 @@
   ;;
 esac
 
-[ "${_has_rm_I}" = y ] && alias rm="rm -I"
 [ "${_has_gnu_ls}" = y ] && alias ls="${_ls} -F --color=auto"
 [ "${_has_gnu_grep}" = y ] && alias grep="grep --color=auto"
 
-unset _has_rm_I
 unset _has_gnu_ls
 unset _has_gnu_grep
 unset _ls
@@ -141,5 +133,8 @@
   alias vi=vim
   export EDITOR=vim
 fi
+
+rm -If "/tmp/.nonexistent.$(date '+%Y%m%d%H%M%S')" 2> /dev/null && alias rm="rm -I"
+
 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"