mkcd: My favourite script

The two commands that I cannot stand to run consecutively are mkdir and cd. It’s a little thing but I despise creating a directory and then entering it with a second command so I wrote a /bin/zsh function to combine them. If you want to do the same add the following into your .zshrc file:

mkcd () {
if [ -z “$1” ] || [ ! -z “$2” ]
echo “Usage: mkcd path”
exit 1
mkdir -p “$1” && cd “$1”