piorunz composed on 2023-09-23 23:50 (UTC+0100):

> Felix Miata wrote:
 
>>> sh srss.sh
>> Sunrise Today: 64:7889657242711361093201601361071834
>> Sunset Today: 65:7242711361093201601361071834
>

>> That sort of resembles the half day format common outside the military.
 
> Sorry, works for me.
 
> Don't forget to fix line breaks in three lines (curl and grep/awk/sed
> lines), because e-mail client splitted them.
> Also, your city may not be supported by this website, this you changed it? 

Still doesn't make sense:

> cat srss.sh
#!/bin/bash

SunTimes=$(curl --silent "https://www.timeanddate.com/sun/usa/gainesville"; 
2>/dev/null)

SunriseTime=$(echo "$SunTimes" | grep -o 'Sunrise Today.*' | awk '{print $3}' | 
sed 's/[^0-9]//g')
SunsetTime=$(echo "$SunTimes" | grep -o 'Sunset Today.*' | awk '{print $3}' | 
sed 's/[^0-9]//g')

# Optional: Insert a colon between hours and minutes
SunriseTime="${SunriseTime:0:2}:${SunriseTime:2}"
SunsetTime="${SunsetTime:0:2}:${SunsetTime:2}"

echo "Sunrise Today:" $SunriseTime
echo "Sunset Today:" $SunsetTime
> sh srss.sh
Sunrise Today: 71:8
Sunset Today: 72:4
>
It's still that idiotic AM/PM nonsense, and the : is in the wrong place.
-- 
Evolution as taught in public schools is, like religion,
        based on faith, not based on science.

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata

Reply via email to