diff bash @ 62:996aa2f81721

[bash] various fixes: - export the path first thing - also add export on sunos case. - alias early - unused _has_bsd_ls - added openbsd, check for colorls which is an awesome command
author Edho Prima Arief <me@myconan.net>
date Fri, 06 May 2011 03:15:24 +0700
parents be4d0b045487
children b7814634220a
line wrap: on
line diff
--- a/bash	Thu May 05 01:13:58 2011 +0700
+++ b/bash	Fri May 06 03:15:24 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)