Skip to content

Instantly share code, notes, and snippets.

@benyarb
Created May 15, 2012 20:13
Show Gist options
  • Save benyarb/2704747 to your computer and use it in GitHub Desktop.
Save benyarb/2704747 to your computer and use it in GitHub Desktop.
A .bashrc function for creating and entering a directory.
# ~/.bashrc
function mkcd {
if [ ! -n "$1" ]; then
echo "Enter a directory name"
elif [ -d $1 ]; then
echo "\`$1' already exists"
else
mkdir $1 && cd $1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment