summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-03-24 22:38:17 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2009-03-24 22:38:17 +0100
commit1ae1b18bbdb49291df4ec7e7081930ddcb548a58 (patch)
treea3ddfcca19261be44251361716e8614746a6f611 /etc
parent8f96ebe5df8d4185cb058ecddb939b580a9a8317 (diff)
mkcd: check for argument
Diffstat (limited to 'etc')
-rwxr-xr-xetc/functions/mkcd13
1 files changed, 10 insertions, 3 deletions
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 <directory name>" > /dev/stderr
+ return 1
+}
+[[ -d $dir ]] && ls=1
+mkdir -p $din
+cd $dir
((ls)) && ls
true