X-Git-Url: http://git.grml.org/?p=grml-etc-core.git;a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=f5b943f34ad5c88bb2d19cc60fef76534894eada;hp=87c9bda1abc1a79a378ff33f1dfe2e3ce67e3bb2;hb=828d43a5f8414c8b0bd90c5ac353f498d2353f7c;hpb=a8546c960706ce0b930e981e358abcfb2d6e6bd3 diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 87c9bda..f5b943f 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -2349,7 +2349,16 @@ cd() { #f5# Create Directoy and \kbd{cd} to it mkcd() { - mkdir -p "$@" && cd "$@" + if (( ARGC != 1 )); then + printf 'usage: mkcd \n' + return 1; + fi + if [[ ! -d "$1" ]]; then + command mkdir -p "$1" + else + printf '`%s'\'' already exists: cd-ing.\n' "$1" + fi + builtin cd "$1" } #f5# Create temporary directory and \kbd{cd} to it