config.fish: Clear home tmp directory occasionally.

This commit is contained in:
Sam Greytalon 2024-02-26 07:37:23 -08:00
parent 79d4f90021
commit 07fce8fd3f
1 changed files with 4 additions and 2 deletions

View File

@ -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