take() now creates an new temporary directory when called without
parameters (and changes the working directory into it).
The new untake() functions changes the current working directory to the
home directory and recursively deletes the old working directory when
the path matches a pattern which is used for temporary directorues
created by take().
}
function take() {
- mkdir -p "$@" && cd "${@:$#}"
+ if [[ $# -eq 0 ]]; then
+ cd "$(mktemp -d)"
+ pwd
+ else
+ mkdir -p "$@" && cd "${@:$#}"
+ fi
+}
+
+function untake() {
+ if [[ "${PWD%tmp.*}" = "${TMPDIR}" ]]; then
+ pwd
+ cd
+ rm -fri "$@" "${OLDPWD}"
+ else
+ echo 'Sorry, not a temporarily taken directory!' >&2
+ fi
}
function zsh_stats() {