Skip to content

Instantly share code, notes, and snippets.

@aravindkumarsvg
Created January 11, 2018 03:13
Show Gist options
  • Save aravindkumarsvg/78e10eb7d086443352f783b4efb984de to your computer and use it in GitHub Desktop.
Save aravindkumarsvg/78e10eb7d086443352f783b4efb984de to your computer and use it in GitHub Desktop.
# 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