From 33cfe12580f9a987163d92949454d2ded1cf33a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Vulquin?= Date: Sun, 10 Nov 2024 11:28:57 +0100 Subject: sh: add /tmp helpers I have really poor discipline when it comes to /tmp. In particular, almost every boot, I create a /tmp/t, and then I pollute it. With this, I can make auto-cleaned-up directories that are arbitrary (`tt`) that's for the quick experiments. And then there's a helper for longer term stuff (via `t`) that's equivalent to what I already do, but nicer. --- dot_local/share/sh/tmp.fish | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 dot_local/share/sh/tmp.fish (limited to 'dot_local/share/sh/tmp.fish') diff --git a/dot_local/share/sh/tmp.fish b/dot_local/share/sh/tmp.fish new file mode 100644 index 0000000..9fe3a84 --- /dev/null +++ b/dot_local/share/sh/tmp.fish @@ -0,0 +1,11 @@ +. hascmd mktemp || return +function t + mkdir -p /tmp/t + cd /tmp/t +end +function tt + set -l dir (mktemp -d) + test -d $dir || return 1 + cd $dir + trap "rm -r '$dir'" EXIT +end -- cgit v1.2.3