Re: Sunrise and Sunset from terminal
piorunz composed on 2023-09-23 23:35 (UTC+0100):
> #!/bin/bash
> SunTimes=$(curl --silent "https://www.timeanddate.com/sun/uk/london"
> 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: 64:7889657242711361093201601361071834
Sunset Today: 65:7242711361093201601361071834
>
That sort of resembles the half day format common outside the military.
--
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 to: