Created
August 27, 2024 12:36
-
-
Save dewomser/ee4968c92f7995ea595df0675aae2a18 to your computer and use it in GitHub Desktop.
Zeitmanager, Prompt mit Minutencountdown für Bash und Vorträge.
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 | |
| # Countdown-Zeit in Minuten | |
| countdown=20 | |
| # Funktion zum Anzeigen des Countdowns | |
| show_countdown() { | |
| local minutes=$1 | |
| local seconds=$2 | |
| tput sc # Cursorposition speichern | |
| tput cup 0 0 # Cursor an den Anfang der Zeile setzen | |
| echo -ne "Countdown: $minutes:$seconds " | |
| tput rc # Cursorposition wiederherstellen | |
| } | |
| # Countdown starten | |
| ( | |
| for ((i=countdown*60; i>=0; i--)); do | |
| minutes=$((i / 60)) | |
| seconds=$((i % 60)) | |
| show_countdown $minutes $seconds | |
| sleep 1 | |
| done | |
| echo -e "\nZeit abgelaufen!" | |
| ) & | |
| # Prompt beibehalten und history aktualisieren | |
| while true; do | |
| read -e -p "$(echo -ne '\n[prompt] > ')" cmd | |
| if [ -n "$cmd" ]; then | |
| history -s "$cmd" | |
| eval $cmd | |
| fi | |
| done |
Author
Author
dieses Skript ist durch Copilot erstellt worden. Nachdem ich mich 5 mal beschwert hatte, weil as nicht funktioniert hat, kam das hier raus.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bildschirmaufnahme_20240827_142025.webm