From: Bastian Dehn Date: Sun, 28 Jun 2026 09:19:01 +0000 (+0200) Subject: fix include shellcheck issues X-Git-Tag: v1.1.7^2~1^2 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=96e60da158073db063306e1254fc384b16a9eae2;p=scantopdf.git fix include shellcheck issues --- diff --git a/tools/includer b/tools/includer index 2dba973..7d80311 100755 --- a/tools/includer +++ b/tools/includer @@ -2,7 +2,7 @@ errlog() { - local lastexit=$? + local lastexit=1 local msg="$1" echo "❌ ERROR: $msg" @@ -13,6 +13,9 @@ errlog() main() { local file="$1" + local dir= + local out= + local include_files= [ -n "$file" ] \ || "missing file" \ @@ -21,18 +24,17 @@ main() || errlog "file $file does not exists" \ || return $? - local dir=$(dirname "$file") + dir=$(dirname "$file") local regex="^#include \"\(.*\)\"$" - local include_files=$(cat "$file" \ - | grep --only-matching "$regex" \ + include_files=$(grep --only-matching "$regex" "$file" \ | sed "s/$regex/\1/") local include_file= local include_regex= - local out=$(cat $file) + out=$(cat "$file") for include_file in $include_files; do - [ -f $dir/$include_file ] \ + [ -f "$dir/$include_file" ] \ || errlog "file $include_file does not exists" \ || return $? @@ -45,4 +47,4 @@ main() echo "$out" } -main $* \ No newline at end of file +main "$*" \ No newline at end of file