From bcb98c80ad9c0003b3d0d317f32dfc9713a2c456 Mon Sep 17 00:00:00 2001 From: Amar Al-Zubaidi <92645199+amarakon@users.noreply.github.com> Date: Fri, 2 Sep 2022 10:00:25 -0400 Subject: [PATCH] Clean temporary directory when canceled --- dman | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dman b/dman index 4192ad8..adeb0c1 100755 --- a/dman +++ b/dman @@ -1,10 +1,11 @@ #!/bin/sh progname=$(basename $0) - directory=/tmp/$progname + cleanup() { rm -rf $directory; } trap cleanup EXIT +trap exit INT HUP TERM [ ! -d "$directory" ] && mkdir $directory title="$(apropos . | dmenu -l 10 | cut -d " " -f 1-2 | tr -d " ")"