commit 15c88cded347436c2b59c0a819c9c18ae1413d79
parent ed83626ee5b0713cfe1e2fe1c093cdb19d8cdc5d
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Fri, 13 Feb 2015 00:39:14 +0100
Removing dependency on seq by using a while loop
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/ansiweather b/ansiweather
@@ -190,7 +190,9 @@ then
humidity=()
pressure=()
sky=()
- for i in $(seq 0 $(($forecast-1)))
+
+ i=0
+ while [ $i -lt $forecast ]
do
days+=("$(echo $weather | jq ".list[$i]")")
dates+=("$(epoch_to_date $(echo ${days[$i]} | jq -r '.dt'))")
@@ -199,6 +201,8 @@ then
humidity+=("$(echo ${days[$i]} | jq -r '.humidity')")
pressure+=("$(echo ${days[$i]} | jq -r '.pressure')")
sky+=("$(echo ${days[$i]} | jq -r '.weather[0].main')")
+
+ i=$(($i + 1))
done
else
city=$(echo $weather | jq -r '.name')
@@ -337,7 +341,9 @@ function get_icon {
if [ $forecast != 0 ]
then
output="$background$text $city forecast $text$delimiter "
- for i in $(seq 0 $(($forecast-1)))
+
+ i=0
+ while [ $i -lt $forecast ]
do
icon=""
if [ $symbols = true ]
@@ -349,6 +355,8 @@ then
then
output="$output$dashes "
fi
+
+ i=$(($i + 1))
done
output="$output\033[0m"
echo -e "$output"