commit 395b23a435e28605411dd21751076f8b5ac8c94a
parent 20f7f2b3cef1d53169f8018a6b07835227dfa770
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Sun, 16 Aug 2015 16:55:39 +0200
More linting
Diffstat:
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/ansiweather b/ansiweather
@@ -185,10 +185,10 @@ fi
epoch_to_date() {
if date -j -r "$1" +"%a %b %d" > /dev/null 2>&1; then
# BSD
- ret=$(date -j -r $1 +"$dateformat")
+ ret=$(date -j -r "$1" +"$dateformat")
else
# GNU
- ret=$(date -d @$1 +"$dateformat")
+ ret=$(date -d "@$1" +"$dateformat")
fi
echo "$ret"
}
@@ -200,7 +200,7 @@ then
forecast=$([ $forecast -gt "$flength" ] && echo "$flength" || echo $forecast)
else
city=$(echo "$weather" | jq -r '.name')
- temperature=$(printf '%.0f' $(echo "$weather" | jq '.main.temp'))
+ 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')
@@ -218,7 +218,7 @@ set -- N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW
if [ "$forecast" = 0 ]
then
- shift $(echo "($azimuth + 11.25)/22.5 % 16" | bc);
+ shift "$(echo "($azimuth + 11.25)/22.5 % 16" | bc)"
direction=$1
fi
@@ -229,10 +229,10 @@ fi
epoch_to_time() {
if date -j -r "$1" +"%r" > /dev/null 2>&1; then
# BSD
- ret=$(date -j -r $1 +"$timeformat")
+ ret=$(date -j -r "$1" +"$timeformat")
else
# GNU
- ret=$(date -d @$1 +"$timeformat")
+ ret=$(date -d "@$1" +"$timeformat")
fi
echo "$ret"
}
@@ -286,7 +286,7 @@ case $units in
scale="°F"
speed_unit="mph"
pressure_unit="inHg"
- pressure=$(printf '%.2f' $(echo "$pressure*0.0295" | bc))
+ pressure=$(printf '%.2f' "$(echo "$pressure*0.0295" | bc)")
;;
esac
@@ -340,9 +340,9 @@ then
while [ $i -lt "$forecast" ]
do
day=$(echo "$weather" | jq ".list[$i]")
- date=$(epoch_to_date $(echo "$day" | jq -r '.dt'))
- low=$(printf "%0.0f" $(echo "$day" | jq -r '.temp.min'))
- high=$(printf "%0.0f" $(echo "$day" | jq -r '.temp.max'))
+ date=$(epoch_to_date "$(echo "$day" | jq -r '.dt')")
+ low=$(printf "%0.0f" "$(echo "$day" | jq -r '.temp.min')")
+ high=$(printf "%0.0f" "$(echo "$day" | jq -r '.temp.max')")
icon=""
if [ "$symbols" = true ]