Last active
February 2, 2026 11:08
-
-
Save dewomser/5383f76856d9dc1337fa26641dcb67b7 to your computer and use it in GitHub Desktop.
soviele Tage bis Ostern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Get today's date in seconds since epoch | |
| today=$(date +%s) | |
| # Get Easter date in YYYY-MM-DD format using ncal -e | |
| #easter_date=$(ncal -e | awk '{print $NF}') | |
| # Convert Easter date to seconds since epoch | |
| # easter=$(date -d "$easter_date" +%s 2>/dev/null) | |
| easter_ncal="$(LC_ALL=en_US ncal -e)" | |
| easter="$(date -d $easter_ncal +%s 2>/dev/null)" | |
| # LC_ALL=en_US.utf8 ncal -e | |
| # Check if the conversion was successful | |
| if [ $? -ne 0 ]; then | |
| echo "Fehler beim Konvertieren des Osterdatums. Überprüfen Sie die Regional- oder Systemkonfiguration." | |
| exit 1 | |
| fi | |
| # Calculate the difference in seconds, then convert to days | |
| diff=$(( (easter - today) / 86400 )) | |
| #diff="($easter - $today)/86400" | |
| #diff=$(echo "$diff" | bc -l) | |
| # Print the result | |
| if [ "$diff" -ge 0 ]; then | |
| echo "Es sind $diff Tage bis Ostern." | |
| else | |
| echo "Ostern ist in diesem Jahr bereits vorbei." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment