From d5355bec6b34f0dcc99d0a48c85030189e4760a2 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 7 Aug 2018 18:35:38 +0200 Subject: FreeAMO: Fixed the returned 141 error --- subprojects/freeamo/src/main_functions | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'subprojects/freeamo/src/main_functions') diff --git a/subprojects/freeamo/src/main_functions b/subprojects/freeamo/src/main_functions index 2e53633..32aeab1 100644 --- a/subprojects/freeamo/src/main_functions +++ b/subprojects/freeamo/src/main_functions @@ -67,17 +67,9 @@ function do-locale { tmp__en_US=$(jq ".results[$entry].$locale_description" "$file" | sed "s|en-US|en_US|" | jq -r .en_US ) tmp__en_GB=$(jq ".results[$entry].$locale_description" "$file" | sed "s|en-GB|en_GB|" | jq -r .en_GB ) - - # Use the first avalible if English is not avaliable - # Circumvent `head -n 1` error `returned 141` - echo ".results[$entry].$locale_description[]" "$file" - if ( jq -r ".results[$entry].$locale_description[]" "$file" | head -n 1 || [[ $? == 141 ]] ) | grep -q "Cannot iterate over null"; then - - tmp=$(jq -r ".results[$entry].$locale_description[]" "$file" | head -n 1) || [[ $? == 141 ]] - - fi - + tmp=$(jq -r ".results[$entry] | select(.$locale_description != null) | .$locale_description" "$file" | head -n 1) || [[ $? == 141 ]] # Avoid `head -n 1` error `returned 141` + if [ "$tmp__en_US" != "null" ]; then -- cgit v1.2.3