diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-28 11:01:33 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-28 11:01:33 +0300 |
| commit | edbf5ba932440148a7c54e88abaa56c6f58a53f3 (patch) | |
| tree | a519fa44ec0ef5bd8762dba5ea5da87bb89859aa | |
| parent | 0da493351f44248e1db4d5be2072e3097243ee4b (diff) | |
Fix tmpclean: guard against empty age variables in test comparisons
| -rw-r--r-- | fish/conf.d/tmputils.fish | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fish/conf.d/tmputils.fish b/fish/conf.d/tmputils.fish index 9ef69f8..9d441e8 100644 --- a/fish/conf.d/tmputils.fish +++ b/fish/conf.d/tmputils.fish @@ -112,7 +112,7 @@ function tmpclean # If the folder is empty or has no files, check its own mtime if test -z "$newest" set -l folder_age (math \( (date +%s) - (stat -c %Y "$folder") \) / 86400) - if test $folder_age -ge $threshold + if test -n "$folder_age"; and test "$folder_age" -ge $threshold set -l basename (basename "$folder") set -l dest "$old_dir/$basename.$datestamp" if set -q dry_run @@ -129,7 +129,7 @@ function tmpclean set -l file_secs (math floor "$newest") set -l age_days (math \( (date +%s) - $file_secs \) / 86400) - if test $age_days -ge $threshold + if test -n "$age_days"; and test "$age_days" -ge $threshold set -l basename (basename "$folder") set -l dest "$old_dir/$basename.$datestamp" if set -q dry_run |
