ansiweather

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

commit 9186a8a48820b84c641c74f8950502da416f333b
parent 0e802a33a6bd4628de87090f60f4ea6b3c2d4953
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Sat, 19 Sep 2015 22:24:03 +0200

Merge pull request #72 from krytarowski/nb-1

Prefer xargs printf over hardcoding printf path
Diffstat:
Mansiweather | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ansiweather b/ansiweather @@ -250,7 +250,7 @@ then forecast=$([ "$forecast" -gt "$flength" ] && echo "$flength" || echo "$forecast") else city=$(echo "$weather" | jq -r '.name') - temperature=$(/usr/bin/printf "%.0f" "$(echo "$weather" | jq '.main.temp')") + temperature=$(echo "$weather" | jq '.main.temp' | xargs printf "%.0f") humidity=$(echo "$weather" | jq '.main.humidity') pressure=$(echo "$weather" | jq '.main.pressure') sky=$(echo "$weather" | jq -r '.weather[0].main') @@ -330,7 +330,7 @@ case $units in scale="°C" speed_unit="m/s" pressure_unit="hPa" - pressure=$(/usr/bin/printf "%.0f" "$pressure") + pressure=$(echo "$pressure" | xargs printf "%.0f") ;; imperial) scale="°F" @@ -338,7 +338,7 @@ case $units in pressure_unit="inHg" if [ "$forecast" = 0 ] then - pressure=$(/usr/bin/printf "%.2f" "$(echo "$pressure*0.0295" | bc)") + pressure=$(echo "$pressure*0.0295" | bc | xargs printf "%.2f") fi ;; esac @@ -394,8 +394,8 @@ then do day=$(echo "$weather" | jq ".list[$i]") date=$(epoch_to_date "$(echo "$day" | jq -r '.dt')") - low=$(/usr/bin/printf "%.0f" "$(echo "$day" | jq -r '.temp.min')") - high=$(/usr/bin/printf "%.0f" "$(echo "$day" | jq -r '.temp.max')") + low=$(echo "$day" | jq -r '.temp.min' | xargs printf "%.0f") + high=$(echo "$day" | jq -r '.temp.max' | xargs printf "%.0f") icon="" if [ "$symbols" = true ]