Change my local mkcd alias into a function
I was grepping for my mkcd alias in the wrong terminal and found
another version, which turned out to be a good thing as Frank's
implementation looks better :)
https://dev.0x50.de/projects/ftzsh/repository/revisions/master/entry/functions/mkcd
--- a/zshrc.d/30-functions.zrc Sat Jul 14 22:56:04 2012 +0200
+++ b/zshrc.d/30-functions.zrc Sat Jul 14 23:13:35 2012 +0200
@@ -39,6 +39,14 @@
done
}
+# This function seen in Frank Terbeck config files is an improvement over
+# my previous mkcd alias...
+functions mkcd() {
+ [[ -z $1 ]] && printf 'usage: mkcd NEW-DIRECTORY\n' && return 1
+ [[ -d $1 ]] && printf 'mkcd: Directory %s already exists; cd-ing\n' $1
+ command mkdir -p -- $1
+ builtin cd -- $1
+}
# genpass()
# Generates a tough password of a given length