diff rc/bash @ 248:fbb03c862b63

Awesome merge.
author Edho Arief <edho@myconan.net>
date Tue, 08 Nov 2011 11:59:49 +0700
parents 3d57990fe9d1
children 68b765e9cf76
line wrap: on
line diff
--- a/rc/bash	Tue Nov 08 11:56:49 2011 +0700
+++ b/rc/bash	Tue Nov 08 11:59:49 2011 +0700
@@ -1,5 +1,10 @@
 #!/usr/bin/env bash
 
+case "${-}" in
+  *i*) ;;
+  *) return;;
+esac
+
 if [ "${ECOS_BASH_LOADED}" != "yes" ]; then
   ECOS_BASH_LOADED="yes"
 else
@@ -35,6 +40,7 @@
 _has_rm_I=
 _has_gnu_ls=
 _has_gnu_grep=
+_ls="ls"
 case "$(uname -s)" in
   Linux)
     _has_rm_I=y
@@ -45,10 +51,11 @@
     [ -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
-    [ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin:${PATH}"
     [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}"
     [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}"
     [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}"
+    [ -d /usr/sfw/bin ] && PATH="${PATH}:/usr/sfw/bin"
+    [ -d /usr/xpg4/bin ] && PATH="${PATH}:/usr/xpg4/bin"
     export PATH
     alias ping="ping -s"
     alias ping6="ping -A inet6"
@@ -59,8 +66,12 @@
     export LSCOLORS=ExGxFxdxCxegedabagExEx
   ;;
   OpenBSD)
-    if command -v colorls > /dev/null 2>&1; then
+    if command -v gls > /dev/null 2>&1; then
+      _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
   ;;
@@ -70,17 +81,18 @@
 esac
 
 [ "${_has_rm_I}" = y ] && alias rm="rm -I"
-[ "${_has_gnu_ls}" = y ] && alias ls="ls -F --color=auto"
+[ "${_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
 
 
 case "${TERM}" in
   xterm*|screen*|dtterm)
-    PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"'
+    PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007";'"${PROMPT_COMMAND}"
   ;;
 esac