#alias rm="rm -i"
#function rm={ rm $@ -i; }

function rm {
for f in "$@";do
  if [[ "$f" =~ ^- ]];then
    continue
  fi
  if [ "$f" = "$HOME" ] || [ "$f" = "$HOME/" ];then
    echo -n 'Are you sure to remove your HOME? '
    read yes
    if ! [[ "$yes" =~ ^[yY] ]];then
      return 0
    fi
  elif [ -d $f ];then
    dn="$(cd "$(dirname $f)";pwd -P)"
    if [ "$dn" = "$HOME" ] || [ "$dn" = "$HOME/" ];then
      echo -n 'Are you sure to remove your HOME? '
      read yes
      if ! [[ "$yes" =~ ^[yY] ]];then
        return 0
      fi
    fi
  fi
done
command rm --preserve-root $@
#command rm -i --preserve-root $@
#command rm --preserve-root $@ -i

}