# HG changeset patch # User Mikael Berthe # Date 1342300415 -7200 # Node ID 7671e95ab8b0a81e2e953f1925734eafcb78df9f # Parent 5dbc9ebf690cbbd4c74a70528c27524ac00bc637 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 diff -r 5dbc9ebf690c -r 7671e95ab8b0 zshrc.d/30-functions.zrc --- 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