Created
May 15, 2012 20:13
-
-
Save benyarb/2704747 to your computer and use it in GitHub Desktop.
A .bashrc function for creating and entering a directory.
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
# ~/.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