Last active
August 29, 2015 14:01
-
-
Save psachin/fc674b216d99ac4eca92 to your computer and use it in GitHub Desktop.
Make and change 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
function mcd() | |
{ | |
# Make and change directory. | |
# Optionally initialize it as a GIT repo. | |
# Copy this function to ~/.bashrc or /etc/profile | |
if [ "$#" -eq 1 ] | |
then | |
echo "Do you want to initialize this as a git repo? " | |
select ynq in "Yes" "No" "Quit"; do | |
case $ynq in | |
Yes) git init "$1"; cd "$1" | |
break;; | |
No) mkdir --parents "$1"; cd "$1" | |
break;; | |
Quit) echo "Bye." | |
break;; | |
esac | |
done | |
else | |
echo "Usage: mcd <DIR_NAME>" > /dev/stderr | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment