From ac6129a7ae59ab79d86fcf95c138f044b71428a7 Mon Sep 17 00:00:00 2001 From: Dan Church Date: Wed, 20 Nov 2024 11:12:59 -0600 Subject: [PATCH 1/2] Simplify case statement Don't surround variables with quotes, they're not necessary in Bash. --- optipdf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/optipdf b/optipdf index 3a63f3e..bcf3f38 100755 --- a/optipdf +++ b/optipdf @@ -27,7 +27,7 @@ Optimize PDF files for size. --no-preserve-timestamp Omit timestamp from original file (default). -- Terminate options list. -Copyright (C) 2021-2022 Dan Church. +Copyright (C) 2021-2024 Dan Church. License GPLv3: GNU GPL version 3.0 (https://www.gnu.org/licenses/gpl-3.0.html) with Commons Clause 1.0 (https://commonsclause.com/). This is free software: you are free to change and redistribute it. @@ -47,7 +47,7 @@ NO_MORE_FLAGS=0 for ARG; do # Assume arguments that don't begin with a - are supposed to be files or other operands if [[ $NO_MORE_FLAGS -eq 0 && $ARG = -* ]]; then - case "$ARG" in + case $ARG in --backup=*) KEEP_BACKUP_SUFFIX=${ARG#*=} ;; From 564366dc909e091a823de3bce3c9cd66687b5853 Mon Sep 17 00:00:00 2001 From: Dan Church Date: Sun, 9 Nov 2025 10:28:30 -0600 Subject: [PATCH 2/2] Simplify check_required_binaries function --- optipdf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/optipdf b/optipdf index bcf3f38..a23079f 100755 --- a/optipdf +++ b/optipdf @@ -114,9 +114,7 @@ check_required_binaries() { done if [[ ${#MISSING[@]} -gt 0 ]]; then printf 'Error: You are missing required programs:\n' >&2 - for BIN in "${MISSING[@]}"; do - printf -- '- %s\n' "$BIN" >&2 - done + printf -- '- %s\n' "${MISSING[@]}" >&2 exit 2 fi }