From 1ae1b18bbdb49291df4ec7e7081930ddcb548a58 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 24 Mar 2009 22:38:17 +0100 Subject: mkcd: check for argument --- etc/functions/mkcd | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'etc/functions') diff --git a/etc/functions/mkcd b/etc/functions/mkcd index 553c90e..4d62298 100755 --- a/etc/functions/mkcd +++ b/etc/functions/mkcd @@ -1,7 +1,14 @@ ## vim:ft=zsh +## create a directory, then change into it typeset -i ls=0 -[[ -d $1 ]] && ls=1 -mkdir -p $1 -cd $1 +typeset dir=$1 + +if [[ -z $dir ]] { + echo "Usage: mkcd " > /dev/stderr + return 1 +} +[[ -d $dir ]] && ls=1 +mkdir -p $din +cd $dir ((ls)) && ls true -- cgit v1.2.3