From: Asperatus Date: Sun, 15 May 2022 05:39:48 +0000 (-0400) Subject: xdg-ninja: change jq json source X-Git-Tag: v0.2.0.0~64^2 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/xdg-ninja.git/commitdiff_plain/500814cc3446805fcb1a6187c2d55568748a20f9 xdg-ninja: change jq json source There was an issue caused by inconsistencies on the implementation of echo through different shells. Some, like bash, did not interpret \n while others, like dash, did. This caused issue when sending the information to jq to parse as it as JSON specifications forbids multi-line strings. A quick fix was applied by giving jq the path to the file to analyze rather than grabbing it from stdin. --- diff --git a/xdg-ninja.sh b/xdg-ninja.sh index e16bd71..d3e43d8 100755 --- a/xdg-ninja.sh +++ b/xdg-ninja.sh @@ -166,14 +166,14 @@ check_file() { # Reads a file from programs/, calls check_file on each file specified for the program check_program() { - INPUT=$1 + PROGRAM=$1 - NAME=$(printf "%s" "$INPUT" | jq -r .name) + NAME=$(jq -r .name "$PROGRAM") while IFS= read -r file; do check_file "$file" "$NAME" done <