diff rc/bashrc @ 400:657f787fbae8

Merge remote-tracking branch 'origin/master'
author Edho Arief <edho@myconan.net>
date Tue, 04 Sep 2012 10:23:37 +0700
parents c01d272af466 c555557692bc
children a23b0f6ee8a2
line wrap: on
line diff
--- a/rc/bashrc	Tue Sep 04 10:22:46 2012 +0700
+++ b/rc/bashrc	Tue Sep 04 10:23:37 2012 +0700
@@ -14,8 +14,33 @@
 [ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before"
 
 _org_path="${PATH}"
+
+# Basic PATH
 export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 
+# pkgsrc
+if test -d /usr/pkg; then
+  PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin"
+  if test -d /usr/pkg/java/openjdk7; then
+    # OpenJDK 7 in pkgsrc
+    PATH="${PATH}:/usr/pkg/java/openjdk7/bin"
+  fi
+fi
+# OpenBSD X11
+test -d /usr/X11R6/bin && PATH="${PATH}:/usr/X11R6/bin"
+# PostgreSQL Yum
+test -d /usr/pgsql-8.4 && PATH="/usr/pgsql-8.4/bin:${PATH}"
+test -d /usr/pgsql-9.1 && PATH="/usr/pgsql-9.1/bin:${PATH}"
+
+# Nuke currently defined functions
+unset -f $(set | grep ' \(\)$' | cut -d ' ' -f 1)
+
+# Nuke bash-completion
+complete -r
+
+# Nuke aliases
+unalias -a
+
 shopt -s histappend
 PROMPT_COMMAND="history -a; history -n"
 export HISTFILESIZE=10000
@@ -34,7 +59,6 @@
 export BLOCK_SIZE=si
 
 alias ls="ls -F"
-alias rm="rm -i"
 alias rd="rdesktop -g 1280x600 -K -a 15 -x m -z -P -r sound:off -r clipboard:CLIPBOARD -5"
 alias man="LANG=C man"
 
@@ -95,7 +119,6 @@
     alias top="top -P"
   ;;
   OpenBSD)
-    PATH="${PATH}:/usr/X11R6/bin"
     if command -v gls > /dev/null 2>&1; then
       _has_gnu_ls=y
       _ls="gls"
@@ -104,13 +127,13 @@
     fi
   ;;
   NetBSD|DragonFly)
-    PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin"
     if command -v gls > /dev/null 2>&1; then
       _has_gnu_ls=y
       _ls="gls"
     elif command -v colorls > /dev/null 2>&1; then
       alias ls="colorls -F"
     fi
+    alias grep='grep --color=auto'
   ;;
   CYGWIN*)
     export PATH="${PATH}:${_org_path}"
@@ -195,6 +218,19 @@
   export LESS='-MRXgij15$nsz-2'
 fi
 
-rm -If "/tmp/.nonexistent.$(date '+%Y%m%d%H%M%S')" 2> /dev/null && alias rm="rm -I"
+# Test if we have GNU rm prefixed by g (esp if on non-GNU system).
+# Usually on old Solaris and {Net,Open,DragonFly}BSD.
+if command -v grm > /dev/null 2>&1; then
+  _rm="grm"
+else
+  _rm="rm"
+fi
+# Test if the specified rm has "-I" parameter since it's much better.
+if "${_rm}" -If "/tmp/.nonexistent.$(date '+%Y%m%d%H%M%S')" 2> /dev/null; then
+  alias rm="${_rm} -I"
+else
+  alias rm="${_rm} -i"
+fi
+unset _rm
 
 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"