Files
salt-states/ssh/files/bashrc.jinja
2020-05-09 00:19:38 -04:00

80 lines
2.3 KiB
Django/Jinja

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# See bash(1) for more options
export HISTCONTROL=ignoredups
export HISTSIZE=2000000
export HISTFILESIZE=2000000
export HISTTIMEFORMAT="(%m/%d/%y) %T "
export PROMPT_COMMAND='history -a'
shopt -s histappend
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias vi='vim'
export EDITOR='vim'
export VISUAL='vim'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # color support
PS1="[\[\e[1;33;1m\]\$(awk '{print \$1}' /proc/loadavg)\[\e[0m\]/\[\e[1;34;1m\]\$(grep -c '^processor' /proc/cpuinfo)\[\e[0m\]][\[\e[1;31;1m\]\u\[\e[0m\]@\[\e[1;32;32m\]\h\[\e[39;1m\] \w\[\e[0m\]]$ "
else
PS1="[\$(awk {'print \$1'} /proc/loadavg)/\$(grep -c '^processor' /proc/cpuinfo)][\u@\h \w]$ "
fi
if which apt-get >/dev/null 2>&1; then
alias update="sudo apt-get update && sudo apt-get -y upgrade"
else
alias update="yum clean all && yum -y update"
fi
if [ $(id -u) -gt 0 ]; then
alias puppet='sudo puppet'
alias fab='sudo fab'
fi
alias random='< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-32};echo'
# https://git.keiran.us/config-mgmt/puppet/raw/commit/09158fc579f5ee2c00f395971d8c986e3ec08788/modules/keir/files/bash/bashrc