view bash @ 52:d07ce874a280

[bash] securing test. Should use bashism but I hate bashism.
author Edho Prima Arief <me@myconan.net>
date Wed, 27 Apr 2011 11:50:03 -0400
parents 4496c7bf953d
children b9db5d89aae3
line wrap: on
line source

#!/usr/bin/env bash

[ -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"

PS1='[\u@\h \W]\$ '

export PAGER='less -Rins'
export EDITOR=vi

alias less='less -Rins'
_has_rm_I=
_has_gnu_ls=
_has_bsd_ls=
case "$(uname -s)" in
  Linux)
    _has_rm_I=y
    _has_gnu_ls=y
  ;;
  SunOS)
    [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
    [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y
    [ -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}"
  ;;
  *BSD)
    _has_rm_I=y
  ;;
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

unset _has_rm_I
unset _has_gnu_ls
unset _has_bsd_ls

export PATH
[ -f .ecos_bash.after ] && . .ecos_bash.after