view bash @ 69:c8c3e4bc4850

[zsh] Default pager.
author Edho Prima Arief <me@myconan.net>
date Fri, 27 May 2011 10:03:55 -0400
parents 4510c8a9d8ec
children 40236fd0a3a5
line wrap: on
line source

#!/usr/bin/env bash

[ -f .ecos_bash.before ] && . .ecos_bash.before

_org_path="${PATH}"
export 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"
#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=
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
    [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y
    [ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin:${PATH}"
    [ -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"
  ;;
  FreeBSD)
    _has_rm_I=y
    CLICOLOR=
  ;;
  OpenBSD)
    if command -v colorls > /dev/null 2>&1; then
      export CLICOLOR=
      alias ls='colorls -F'
    fi
  ;;
  CYGWIN*)
    export PATH="${PATH}:${_org_path}"
  ;;
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


case "${TERM}" in
  xterm*|screen*|dtterm)
    PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"'
  ;;
esac

if command -v vim > /dev/null 2>&1; then
  alias vi=vim
  export EDITOR=vim
fi
[ -f .ecos_bash.after ] && . .ecos_bash.after