• Dein Produkt auf beyond.lol
  • Kontakt
  • Kontakt
  • IP
  • Impressum
  • Datenschutz
Montag, Februar 6, 2023
  • Login
beyond.lol
ADVERTISEMENT
  • Software
    • Open Source
  • Hardware
  • Tutorials
    • Web
    • Linux
    • Windows
    • Gaming
    • PHP
    • Raspberry Pi
  • Crypto-Welt
    • Altcoins
    • Bitcoin
    • Ethereum
    • Mining
    • Press Releases
  • Scripts
    • BASH
    • PowerShell
  • Lustiges aus der IT
    • Spamantworten
  • Gaming
  • and More
    • Dein Produkt auf beyond.lol
    • Kontakt
    • Impressum
    • Datenschutz
    • Tools
      • Wie ist meine IP?
No Result
View All Result
  • Software
    • Open Source
  • Hardware
  • Tutorials
    • Web
    • Linux
    • Windows
    • Gaming
    • PHP
    • Raspberry Pi
  • Crypto-Welt
    • Altcoins
    • Bitcoin
    • Ethereum
    • Mining
    • Press Releases
  • Scripts
    • BASH
    • PowerShell
  • Lustiges aus der IT
    • Spamantworten
  • Gaming
  • and More
    • Dein Produkt auf beyond.lol
    • Kontakt
    • Impressum
    • Datenschutz
    • Tools
      • Wie ist meine IP?
No Result
View All Result
beyond.lol
No Result
View All Result

BASH Countdown bis Weihnachten

Patrick by Patrick
Dezember 19, 2022
in BASH, Scripts
Reading Time: 2 mins read
3
A A
0
bash,countdown,weihnachten » beyond.lol
0
SHARES
34
VIEWS
Auf Facebook teilenAuf Twitter teilenAuf Whatsapp teilen
ADVERTISEMENT

Ein BASH Skript, welches einen Countdown bis Weihnachten anzeigt. Kann natürlich auch für andere Tage benutzt werden.

#!/bin/bash

# Set the target date (Christmas)
target_month=12
target_day=25

# Get the current date
current_month=$(date +%m)
current_day=$(date +%d)

# Calculate the number of days until Christmas
if [ $current_month -gt $target_month ] || [ $current_month -eq $target_month -a $current_day -ge $target_day ]
then
  # Christmas has already passed this year, so set the target date to next year
  target_year=$(date +%Y)
  let "target_year+=1"
else
  # Christmas has not passed yet this year
  target_year=$(date +%Y)
fi

# Calculate the number of seconds until Christmas
target_date="$target_year-$target_month-$target_day 00:00:00"
seconds_until_christmas=$(date -d "$target_date" +%s)
current_time=$(date +%s)
let "seconds_until_christmas-=current_time"

# Calculate the number of days, hours, minutes, and seconds until Christmas
days=$((seconds_until_christmas / 86400))
hours=$((seconds_until_christmas % 86400 / 3600))
minutes=$((seconds_until_christmas % 3600 / 60))
seconds=$((seconds_until_christmas % 60))

# Print the countdown message
echo "There are $days days, $hours hours, $minutes minutes, and $seconds seconds until Christmas!"

Das Skript setzt das Ziel-Datum (Weihnachten) auf den 25. Dezember und berechnet dann die Anzahl der Tage, Stunden, Minuten und Sekunden bis zu diesem Datum. Wenn das aktuelle Datum nach dem Ziel-Datum liegt, wird das Ziel-Jahr um 1 erhöht, um den Countdown für das nächste Jahr zu berechnen.

Um das Skript auszuführen, speichere es zunächst in einer Datei mit einem beliebigen Namen und fügen Sie ihm dann Ausführungsberechtigungen hinzu:

chmod +x countdown.sh

Danach kannst du das Skript ausführen

./countdown.sh
Previous Post

PowerShell Uhrzeit mit NTP synchronisieren

Next Post

BASH Aktienkurs mit der Yahoo Finance API anzeigen

Patrick

Patrick

IT Systemadministrator

Schreibe einen Kommentar Antworten abbrechen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Instagram

Folg uns jetzt auf Instagram

  • Lieber einen Böller weniger zünden, dafür die Finger behalten. Guten Rutsch!
-
-
-
-
#silvester #neujahr #böller #informatik #tippe #schreiben #informatik #it #edv #technik #beyond #beyond.lol #itblog #blog #finger #feuerwerk #fingerweg #verletzt #aua #feuer #10fingersystem #tippen #indietastenhauen #rutschen #rakete #schwarzpulver #vorsicht #2023 #2022 #gutenrutsch
  • Wir wünschen euch frohe Festtage und lasst es euch gut gehen!
_
_
_
_
#beyond #beyond.lol #blog #itblog #weihnachten #geschenke #eltern #probleme #itprobleme #edv #informatik #it #data #xams #christmas #happy #kinderleinkommetundrepariertmeinhandy #kinder
  • Wir haben da mal so eine Frage ... Wieso versteht kein Informatiker mehr die Grundfunktionen eines DNS? Lernt Ihr das nicht mehr in der Schule?

man dig ;-)

-
-
-
-
#dns #ausbildung #telefonbuch #domainnameserver #linux #windows #dig #nameserver #ns #it #informatik #edv #digitalisierung #hosting #web #agentur #beyond #beyond.lol #itblog #blog #wieso #lernen #schule #lehre #lehrer #informatikausbildung #bitte #bilden #bildung #nameserver
ADVERTISEMENT
  • Dein Produkt auf beyond.lol
  • Kontakt
  • Kontakt
  • IP
  • Impressum
  • Datenschutz
Bloggerei.de - Bewertung für beyond.lol

© 2023 beyond.lol - IT, Crypto & more beyond.lol.

No Result
View All Result
  • Software
    • Open Source
  • Hardware
  • Tutorials
    • Web
    • Linux
    • Windows
    • Gaming
    • PHP
    • Raspberry Pi
  • Crypto-Welt
    • Altcoins
    • Bitcoin
    • Ethereum
    • Mining
    • Press Releases
  • Scripts
    • BASH
    • PowerShell
  • Lustiges aus der IT
    • Spamantworten
  • Gaming
  • and More
    • Dein Produkt auf beyond.lol
    • Kontakt
    • Impressum
    • Datenschutz
    • Tools
      • Wie ist meine IP?

© 2023 beyond.lol - IT, Crypto & more beyond.lol.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

Zur mobilen Version gehen