From 867d2e01961c8f8fea6110a91b73b4d48e5df8fa Mon Sep 17 00:00:00 2001 From: Eugene Kalinin Date: Fri, 20 Aug 2021 11:04:08 +0300 Subject: [PATCH] Add taketmp function --- lib/functions.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/functions.zsh b/lib/functions.zsh index 73b491a59..96818e70f 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -40,6 +40,10 @@ function mkcd takedir() { mkdir -p $@ && cd ${@:$#} } +function taketmp() { + cd $(mktemp -d) +} + function takeurl() { local data thedir data="$(mktemp)" @@ -60,6 +64,8 @@ function take() { takeurl "$1" elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then takegit "$1" + elif [[ "$1" == "" ]]; then + taketmp else takedir "$@" fi