Created
March 13, 2012 15:05
-
-
Save mtak/2029318 to your computer and use it in GitHub Desktop.
Bash configuration file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Terminal options | |
shopt -s histappend | |
shopt -s cdspell | |
#PROMPT_COMMAND='history -a' | |
HISTFILESIZE=5000 | |
HISTCONTROL=ignoredups | |
TERM=xterm | |
export PROMPT_COMMAND HISTFILESIZE HISTCONTROL TERM | |
# Aliases | |
alias sl=ls | |
alias ps="ps -efZ" | |
alias grpe="grep" | |
# Shell functions | |
init () { | |
hostname=`hostname` | |
zoneadm list -vic | grep global >/dev/null; | |
globalToggle=$?; | |
echo "Are you sure you want to do init $* on machine ${hostname}?" | |
if [ $globalToggle -eq 0 ]; then | |
echo "THIS IS A GLOBAL MACHINE" | |
fi | |
read -p "Enter to continue or CTRL+C to abort..." | |
/sbin/init $* | |
} | |
# Convert bytes to gigabytes and vice versa | |
b2g () { echo $(($1/(1024*1024*1024))); } | |
g2b () { echo $(($1*(1024*1024*1024))); } | |
mailme () { | |
uuencode $1 $1 | mailx -s "$1" [email protected] | |
} | |
# Coloured grep | |
if [ -x "`which ggrep`" ]; then | |
export GREP_COLOR='1;32' | |
alias grep="`which ggrep` --color=auto" | |
fi | |
# Settings for local host | |
if [ `hostname` = "thor" ]; then | |
/usr/openwin/bin/xset b 0 | |
if [ `/usr/bin/id -u` = 101 ]; then | |
/home/mtak/bin/ssh-agent_start_stop | |
export SSH_AUTH_SOCK=`cat ~/.ssh_auth_sock` | |
export SSH_AGENT_PID=`cat ~/.ssh_agent_pid` | |
sshLines=`/usr/bin/ssh-add -l | grep -v "agent has no identities" | wc -l` | |
if [ ${sshLines} = "0" ]; then | |
echo "SSH key caching expired, please reenter your credentials" | |
/usr/bin/ssh-add -t 30600 | |
fi | |
fi | |
else | |
# Other systems don't deal well with rxvt | |
export TERM=xterm | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment