commit 2677932c560fa54c6c22fa706d01c0d17303f1a8 parent e7e8425c3bf9ad09b319204fbf50aec31da69ab6 Author: Chris Down <chris@chrisdown.name> Date: Fri, 3 Apr 2020 12:27:46 +0100 clipmenud: Check cache file existence before vacuuming Fixes #123. Diffstat:
M | clipmenud | | | 3 | ++- |
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clipmenud b/clipmenud @@ -195,7 +195,8 @@ while true; do fi done - if (( CM_MAX_CLIPS )) && (( "$(wc -l < "$cache_file")" > CM_MAX_CLIPS_THRESH )); then + # The cache file may not exist if this is the first run and data is skipped + if (( CM_MAX_CLIPS )) && [[ -f "$cache_file" ]] && (( "$(wc -l < "$cache_file")" > CM_MAX_CLIPS_THRESH )); then info "Trimming clip cache to CM_MAX_CLIPS ($CM_MAX_CLIPS)" trunc_tmp=$(mktemp) tail -n "$CM_MAX_CLIPS" "$cache_file" | uniq > "$trunc_tmp"