Created
June 25, 2015 15:12
-
-
Save shoaibi/5159d0f16321d6797707 to your computer and use it in GitHub Desktop.
My bash configuration containing overrides/additions
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
# find partition name for a given filename | |
findpart() { [ -e "$1" ] && df -P "$1" | awk '/^\/dev/ {print $1}' || echo "$1 not found"; } | |
# Verbose version of sleep | |
countdown() | |
{ | |
secs=$1 | |
while [ $secs -gt 0 ]; do | |
echo -ne "$secs\033[0K\r" | |
sleep 1 | |
: $((secs--)) | |
done | |
return 0 | |
} | |
# ex - archive extractor | |
# usage: ex <file> | |
ex () | |
{ | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; | |
*.tbz2) tar xjf $1 ;; | |
*.tgz) tar xzf $1 ;; | |
*.zip) unzip $1 ;; | |
*.Z) uncompress $1;; | |
*.7z) 7z x $1 ;; | |
*) echo "'$1' cannot be extracted via ex()" ;; | |
esac | |
else | |
echo "'$1' is not a valid file" | |
fi | |
} | |
stty -ixon | |
### Limited Auto correction | |
#shopt -s autocd | |
shopt -s cdspell | |
shopt -s checkwinsize | |
shopt -s cmdhist | |
shopt -s dotglob | |
shopt -s expand_aliases | |
shopt -s extglob | |
shopt -s histappend | |
shopt -s hostcomplete | |
shopt -s nocaseglob | |
# Better Completion | |
complete -C aws_completer aws | |
complete -d pushd -C cd | |
complete -cf sudo | |
complete -W "$(echo $(grep '^ssh ' $HOME/.bash_history | sort -u | sed 's/^ssh //'))" ssh | |
complete -o default -o nospace -W "$(/usr/bin/env ruby -ne 'puts $_.split(/[,\s]+/)[1..-1].reject{|host| host.match(/\*|\?/)} if $_.match(/^\s*Host\s+/);' < $HOME/.ssh/config)" scp sftp ssh | |
##### PS1 stuff | |
######### USING LIQUID PROMPT INSTEAD | |
#C_RESET="\[\033[0m\]" | |
#C_RED="\[\033[0;31m\]" | |
#C_GREEN="\[\033[0;32m\]" | |
#C_BROWN="\[\033[0;33m\]" | |
#C_BLUE="\[\033[0;34m\]" | |
#C_PURPLE="\[\033[0;35m\]" | |
#C_CYAN="\[\033[0;36m\]" | |
#C_GRAY="\[\033[1;30m\]" | |
#C_WHITE="\[\033[1;37m\]" | |
#C_STRONG_GRAY="\[\033[0;37m\]" | |
#C_STRONG_YELLOW="\[\033[1;33m\]" | |
#C_STRONG_BLUE="\[\033[1;34m\]" | |
#C_STRONG_CYAN="\[\033[1;36m\]" | |
#C_STRONG_PURPLE="\[\033[1;35m\]" | |
#C_STRONG_RED="\[\033[1; 31m\]" | |
#C_STRONG_GREEN="\[\033[1;32m\]" | |
#PS1="[$C_CYAN\d|\t$C_RESET][$C_RED\u@$C_GREEN\h$C_RESET:$C_BLUE\w$C_RESET]$C_BROWN\$ $C_RESET" | |
#PS1="\n[$C_CYAN\d|\t$C_RESET] [$C_RED\u@$C_GREEN\h$C_RESET:$C_BLUE\w$C_RESET] $C_BROWN\$(vcprompt -f '%s:%P/%b %a%m%u')$_C_RESET $C_GRAY\$(vcprompt -f '%a%m%u')$C_RESET \n$C_STRONG_GRAY\$ $C_RESET" | |
#PS1="[$C_RED\u@$C_GREEN\h$C_RESET:$C_BLUE\w$C_RESET]\n$C_BROWN\$(vcprompt -f ' %n:%P/%b')$_C_RESET$C_GRAY\$(vcprompt -f '%r %m%u ')$C_RESET$C_STRONG_GRAY\$$C_RESET " | |
#PS1="[$C_RED\u@$C_GREEN\h$C_RESET:$C_BLUE\w$C_RESET]$C_BROWN\$(vcprompt -f ' %s:%P/%b')$_C_RESET$C_GRAY\$(vcprompt -f '%a%m%u ')$C_RESET$C_STRONG_GRAY\$$C_RESET " | |
#PS1="[\[\e[0;31m\]\u@\[\e[0;32m\]\H:\[\e[0;34m\]\w\[\e[0;37m\]]\$\[\e[30;0m\] " | |
######### Exporting Stuff | |
#export PS1 | |
export EDITOR='vim' | |
export VISUAL='vim' | |
export PAGER='most' | |
#export GREP_COLOR="01;38;5;3"; | |
export HISTSIZE=10000 | |
export HISTFILESIZE=${HISTSIZE} | |
export HISTCONTROL=ignoreboth | |
export HISTIGNORE="bg:fg:exit:clear:ls:sbc:source"; | |
export FIGNORE=".old:.back:.bak:.:~"; | |
#export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' | |
#export LS_OPTIONS='--color' | |
export CLICOLOR=1 | |
#export DE='openbox' | |
export DE='xfce' | |
export BROWSER='/usr/bin/chromium' | |
# Java Home | |
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") | |
# android sdk | |
#export PATH=${PATH}:/home/shoaibi/rootfs/android-sdk-linux/tools:/home/shoaibi/rootfs/android-sdk-linux/platform-tools:/home/shoaibi/rootfs/eclipse | |
# Yii | |
#export PATH=/home/shoaibi/public_html/yii/framework:${PATH} | |
# composer | |
export PATH=~/.composer/vendor/bin:${PATH} | |
export ROOTFS=/home/shoaibi/rootfs | |
export ROOTFS_BIN=$ROOTFS/bin | |
export PATH=$ROOTFS_BIN:$PATH | |
#VCPROMPT_BIN=$ROOTFS/vcprompt/bin | |
RUBYGEMS_BIN=$(ruby -rubygems -e "puts Gem.user_dir")/bin | |
export PATH=$RUBYGEMS_BIN:$PATH | |
#export PATH=$VCPROMPT_BIN:$PATH | |
export PERL_LOCAL_LIB_ROOT="/home/shoaibi/rootfs/perl5"; | |
export PERL_MB_OPT="--install_base /home/shoaibi/rootfs/perl5"; | |
export PERL_MM_OPT="INSTALL_BASE=/home/shoaibi/rootfs/perl5"; | |
export PERL5LIB="/home/shoaibi/rootfs/perl5/lib/perl5/x86_64-linux-gnu-thread-multi:/home/shoaibi/rootfs/perl5/lib/perl5"; | |
export PATH="/home/shoaibi/rootfs/perl5/bin:$PATH"; | |
export PULSE_LATENCY_MSEC=60 | |
export LC_COLLATE=en_US.UTF-8 | |
LANG=en_US.UTF-8 | |
export LC_CTYPE="en_US.UTF-8" | |
export LC_NUMERIC="en_US.UTF-8" | |
export LC_TIME="en_US.UTF-8" | |
export LC_COLLATE="en_US.UTF-8" | |
export LC_MONETARY="en_US.UTF-8" | |
export LC_MESSAGES="en_US.UTF-8" | |
export LC_PAPER="en_US.UTF-8" | |
export LC_NAME="en_US.UTF-8" | |
export LC_ADDRESS="en_US.UTF-8" | |
export LC_TELEPHONE="en_US.UTF-8" | |
export LC_MEASUREMENT="en_US.UTF-8" | |
export LC_IDENTIFICATION="en_US.UTF-8" | |
#exprt GTK_THEME=Adwaita | |
export CLUTTER_BACKEND=x11 | |
# Aliases | |
if [ -f ~/.bash/.bash_aliases ]; then | |
# this is a simple file that sources all files from | |
# ~/.bash/aliases/ dir | |
. ~/.bash/.bash_aliases | |
fi | |
# load commacd, no longer used | |
#[[ -r "/usr/share/commacd/commacd.bash" ]] && source /usr/share/commacd/commacd.bash | |
# Only load Liquid Prompt in interactive shells, not from a script or from scp | |
[[ $- = *i* ]] && source `which liquidprompt` | |
### Chef not used anymore | |
#eval "$(chef shell-init bash)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment