From 2677932c560fa54c6c22fa706d01c0d17303f1a8 Mon Sep 17 00:00:00 2001 From: Chris Down Date: Fri, 3 Apr 2020 12:27:46 +0100 Subject: [PATCH] clipmenud: Check cache file existence before vacuuming Fixes #123. --- clipmenud | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clipmenud b/clipmenud index ff3d882..2367a1a 100755 --- 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"