From 07fce8fd3feece4508305a4b44157c374eb4d949 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.config/fish/config.fish b/.config/fish/config.fish index e69f1ea..43ed17c 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -49,8 +49,10 @@ 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" ] - timeout 5 git sit && date '+%s' > "$HOME/.local/last_shell" + set 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