projects
/
grml-etc-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
zshrc: Make mkcd() more robust
[grml-etc-core.git]
/
etc
/
zsh
/
zshrc
diff --git
a/etc/zsh/zshrc
b/etc/zsh/zshrc
index
87c9bda
..
f5b943f
100644
(file)
--- a/
etc/zsh/zshrc
+++ b/
etc/zsh/zshrc
@@
-2349,7
+2349,16
@@
cd() {
#f5# Create Directoy and \kbd{cd} to it
mkcd() {
#f5# Create Directoy and \kbd{cd} to it
mkcd() {
- mkdir -p "$@" && cd "$@"
+ if (( ARGC != 1 )); then
+ printf 'usage: mkcd <new-directory>\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
}
#f5# Create temporary directory and \kbd{cd} to it