diff rc/bash @ 266:69b9cbf9f3c0

rm -I saner test.
author Edho Arief <edho@myconan.net>
date Thu, 24 Nov 2011 13:02:04 +0700
parents c6c322c57e0e
children e35a36bb832e
line wrap: on
line diff
--- a/rc/bash	Thu Nov 24 12:24:05 2011 +0700
+++ b/rc/bash	Thu Nov 24 13:02:04 2011 +0700
@@ -34,18 +34,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
@@ -60,7 +57,6 @@
     [ -f "/usr/share/lib/terminfo/?/${TERM}" ] || export TERM=dtterm
   ;;
   FreeBSD)
-    _has_rm_I=y
     export CLICOLOR=
     export LSCOLORS=ExGxFxdxCxegedabagExEx
   ;;
@@ -91,11 +87,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
@@ -138,5 +132,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"