So, how often do you mkdir a directory without cd’ing into right after?
Sure, it does happen, but not very often. Which is why I have the following
mkcd command in my .zshrc:
mkcd () {
mkdir -p "${1}"
cd "${1}"
}I was reminded of this again when setting up a new machine (in the few minutes
before I had cloned my dotfiles repository). So, if you want to save some
seconds of cd’ing into newly created directories, add the code above to your
.bashrc/.zshrc and alias mkdir to echo "no. use 'mkcd'." for the first
few days.