Created
January 11, 2018 03:13
-
-
Save aravindkumarsvg/78e10eb7d086443352f783b4efb984de to your computer and use it in GitHub Desktop.
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
# utility function which is used to create and change | |
# to the given directory name | |
# Add to the .bashrc file | |
# usage: | |
# mkcd directory_name | |
mkcd() { | |
local directory_name="${1}" | |
if [ -z $directory_name ] | |
then | |
echo "Pass the directory name as the argument!!!" > /dev/stderr | |
elif [ -d "${directory_name}" ] | |
then | |
cd $directory_name | |
unset directory_name | |
else | |
mkdir -p $directory_name | |
cd $directory_name | |
unset directory_name | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment