From cf24a4ff3b8115971a7a2236df011fa8f79255e2 Mon Sep 17 00:00:00 2001 From: Sam Talonborn Date: Mon, 26 Feb 2024 07:37:23 -0800 Subject: [PATCH] config.fish: Clear home tmp directory occasionally. --- .config/fish/config.fish | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 3bbe734..93d1461 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -59,7 +59,9 @@ if status --is-interactive alias g="git" mkdir -p ~/.local - if [ (expr (date '+%s') - (cat "$HOME/.local/last_shell" 2>/dev/null || echo 0)) -gt "28800" ] + time_diff=(expr (date '+%s') - (cat "$HOME/.local/last_shell" 2>/dev/null || echo 0)) + if [ "$time_diff" -gt "28800" ] + [ -d "$HOME/tmp" ] && rm -rf "$HOME/tmp/*" git sit && date '+%s' > "$HOME/.local/last_shell" echo "" end