From 500814cc3446805fcb1a6187c2d55568748a20f9 Mon Sep 17 00:00:00 2001 From: Asperatus Date: Sun, 15 May 2022 01:39:48 -0400 Subject: [PATCH] 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. --- xdg-ninja.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 <