ansiweather

Weather in terminal, with ANSI colors and Unicode symbols
Log | Files | Refs | README | LICENSE

commit d80b63afc5d8f9475eae8cbef5e7752d5ec8b2a6
parent 52c1a15a33471209cff67bfed3fad3c77817fb94
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Thu, 30 Jul 2015 22:15:46 +0200

Quoting strings before piping them to jq

Diffstat:
Mansiweather | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/ansiweather b/ansiweather @@ -162,7 +162,7 @@ then exit fi -status_code=$(echo $weather | jq -r '.cod') +status_code=$(echo "$weather" | jq -r '.cod') if [ $status_code != 200 ] then @@ -187,7 +187,7 @@ function epoch_to_date { if [ $forecast != 0 ] then - city=$(echo $weather | jq -r '.city.name') + city=$(echo "$weather" | jq -r '.city.name') flength=$(echo $weather | jq '.list | length') forecast=$([[ $forecast -gt $flength ]] && echo $flength || echo $forecast) # days=() @@ -212,15 +212,15 @@ then i=$(($i + 1)) done else - city=$(echo $weather | jq -r '.name') - temperature=$(printf '%.0f' $(echo $weather | jq '.main.temp')) - humidity=$(echo $weather | jq '.main.humidity') - pressure=$(echo $weather | jq '.main.pressure') - sky=$(echo $weather | jq -r '.weather[0].main') - sunrise=$(echo $weather | jq '.sys.sunrise') - sunset=$(echo $weather | jq '.sys.sunset') - wind=$(echo $weather | jq '.wind.speed') - azimuth=$(echo $weather | jq '.wind.deg') + city=$(echo "$weather" | jq -r '.name') + temperature=$(printf '%.0f' $(echo "$weather" | jq '.main.temp')) + humidity=$(echo "$weather" | jq '.main.humidity') + pressure=$(echo "$weather" | jq '.main.pressure') + sky=$(echo "$weather" | jq -r '.weather[0].main') + sunrise=$(echo "$weather" | jq '.sys.sunrise') + sunset=$(echo "$weather" | jq '.sys.sunset') + wind=$(echo "$weather" | jq '.wind.speed') + azimuth=$(echo "$weather" | jq '.wind.deg') fi