Create a gist now

Instantly share code, notes, and snippets.

@jbwhit /part.bash
Last active Aug 29, 2015

What would you like to do?
A small piece of a .bashrc that could be very useful.
# Add to your bashrc -- look at what you're adding piece by piece
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# 2 line command prompt
export PS1="\n# \w\n# \[${Green}\]\h\[${Color_Off}\] $ "
shopt -s checkwinsize # After each command, checks the windows size and changes lines and columns
# This will let you type filenames, commands and directories without concern of upper or lowercase.
bind "set completion-ignore-case on"
bind "set bell-style none"
# eg. save mc
# cd mc # no '$' is necessary
if [ ! -f ~/.dirs ]; then # if doesn't exist, create it
touch ~/.dirs
fi
alias show='cat ~/.dirs'
save (){
command sed "/!$/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs; source ~/.dirs ;
source ~/.dirs # Initialization for the above 'save' facility: source the .sdirs file
}
source ~/.dirs # Initialization for the above 'save' facility: source the .sdirs file
shopt -s cdable_vars # set the bash option so that no '$' is required when using the above facility
# Function that prints your path in a readable way because echo $PATH looks stupid and horrible.
function path(){
old=$IFS
IFS=:
printf "%s\n" $PATH
IFS=$old
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment