Created
May 2, 2016 01:36
-
-
Save scottzirkel/a4d1c6f50ac07d60c2bc46b5cfab05bd to your computer and use it in GitHub Desktop.
Make directory then CD in
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
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
Just a quick little function for your bashrc/zshrc/whateverrc file.
mkcd dirname
and you are instantly in your brand new dir (if it exists).