diff bash @ 63:b7814634220a

[bash] branch merge, added EDITOR change to vim when detected.
author Edho Prima Arief <me@myconan.net>
date Sun, 08 May 2011 09:43:58 +0700
parents 996aa2f81721
children 4510c8a9d8ec
line wrap: on
line diff
--- a/bash	Sun May 08 09:42:06 2011 +0700
+++ b/bash	Sun May 08 09:43:58 2011 +0700
@@ -2,7 +2,7 @@
 
 [ -f .ecos_bash.before ] && . .ecos_bash.before
 
-PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
+export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 
 PS1='[\u@\h \W]\$ '
 
@@ -13,11 +13,12 @@
 #assuming POSIX grep
 alias fgrep="grep -F"
 alias egrep="grep -E"
+alias ls="ls -F"
+alias rm="rm -i"
 
 _has_rm_I=
 _has_gnu_ls=
 _has_gnu_grep=
-_has_bsd_ls=
 case "$(uname -s)" in
   Linux)
     _has_rm_I=y
@@ -31,6 +32,7 @@
     [ -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}"
+    export PATH
     alias ping="ping -s"
     alias ping6="ping -A inet6"
   ;;
@@ -38,29 +40,22 @@
     _has_rm_I=y
     CLICOLOR=
   ;;
+  OpenBSD)
+    if command -v colorls > /dev/null 2>&1; then
+      export CLICOLOR=
+      alias ls='colorls -F'
+    fi
+  ;;
 esac
-if [ "${_has_rm_I}" = y ]; then
-  alias rm="rm -I"
-else
-  alias rm="rm -i"
-fi
 
-if [ "${_has_gnu_ls}" = y ]; then
-  alias ls="ls -F --color=auto"
-else
-  alias ls="ls -F"
-fi
-
-if [ "${_has_gnu_grep}" = y ]; then
-  alias grep="grep --color=auto"
-fi
+[ "${_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 _has_bsd_ls
 
-export PATH
 
 case "${TERM}" in
   xterm*|screen*|dtterm)
@@ -68,5 +63,8 @@
   ;;
 esac
 
-command -v vim > /dev/null 2>&1 && alias vi=vim
+if command -v vim > /dev/null 2>&1; then
+  alias vi=vim
+  export EDITOR=vim
+fi
 [ -f .ecos_bash.after ] && . .ecos_bash.after