Created
February 3, 2016 13:35
-
-
Save carmelyne/28d58433bbb0ff9b2676 to your computer and use it in GitHub Desktop.
bash
This file contains hidden or 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
############# | |
# Colors # | |
############# | |
# Set prompt: " username@hostname/directory/tree $ " (with colors) | |
export PS1=" \[\e[32;1m\]\u\[\e[0m\]\[\e[32m\]@\h\[\e[36m\]\w \[\e[33m\]\$ \[\e[0m\]" | |
######### | |
# AlIAS # | |
######### | |
alias home='cd ~' | |
alias l='ls -lah' | |
alias h='history' | |
alias hg='history|grep' | |
alias c='clear' | |
alias ..='cd ..' | |
alias ...='cd ../..' | |
# Create and change to directory | |
function mkcd { | |
if [ $# -ne 1 ]; then | |
echo "usage: mkcd directory_name" | |
elif [ -d "${1}" ]; then | |
echo "(directory already existed)" | |
cd "$1" | |
elif [ -e "${1}" ]; then | |
echo "file exists" | |
else | |
mkdir "${1}" && cd "${1}" | |
fi | |
} | |
# Remove empty working directory | |
function rmwd { | |
if (shopt -s nullglob dotglob; f=(*); ((! ${#f[@]}))); then | |
# directory is empty | |
rmdir `"pwd"` | |
cd .. | |
else | |
echo "not empty" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment