diff options
Diffstat (limited to 'etc')
-rwxr-xr-x | etc/functions/mkcd | 13 |
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 |