On 23/09/2023 22:51, s...@gmx.com wrote:
Is there a way to get sunrise and sunset time from command interpreter? I want to use its output for a script!
Of course. #!/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 -- With kindest regards, Piotr. ⢀⣴⠾⠻⢶⣦⠀ ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org/ ⠈⠳⣄⠀⠀⠀⠀