From 6f60a951671e7adefebd11bfa3488448307d4b89 Mon Sep 17 00:00:00 2001 From: vonProteus <> Date: Sat, 22 Mar 2025 19:10:57 +0100 Subject: [PATCH] cdtmp --- zsh.d/50_cdtmp.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 zsh.d/50_cdtmp.zsh diff --git a/zsh.d/50_cdtmp.zsh b/zsh.d/50_cdtmp.zsh new file mode 100644 index 0000000..ea59079 --- /dev/null +++ b/zsh.d/50_cdtmp.zsh @@ -0,0 +1,18 @@ +# vim: ft=zsh + +function cdtmp { + if [ -z "$MY_TEMP_DIR" ]; then + newtmp + fi + cd "$MY_TEMP_DIR" +} + +function newtmp { + export MY_TEMP_DIR="$(mktemp -d)" + echo "new tmp dir in $MY_TEMP_DIR" +} + +function cdnewtmp { + newtmp + cdtmp +}