39 lines
1.4 KiB
Bash
Executable file
39 lines
1.4 KiB
Bash
Executable file
uhrzeit(){
|
|
length=${#AbfahrtUhr}
|
|
|
|
# Check if the number has at least 3 digits
|
|
if [[ $length -eq 1 ]]; then
|
|
mpv modules/dt/gleise_zahlen//hoch/$AbfahrtUhr.wav 2&>1 1>/dev/null
|
|
echo "1 Digit"
|
|
elif [[ $length -eq 2 ]]; then
|
|
mpv modules/dt/gleise_zahlen//hoch/$AbfahrtUhr.wav 2&>1 1>/dev/null
|
|
echo "2 Digit"
|
|
elif [[ $length -eq 3 ]]; then
|
|
# Get the first part by truncating to the nearest hundred
|
|
first_part=$(($AbfahrtUhr / 100 * 100)) # Truncate to the nearest hundred
|
|
second_part=$(($AbfahrtUhr % 100)) # Get the remainder (last two digits)
|
|
|
|
printf "${RED}$first_part $second_part${NC}\n"
|
|
mpv modules/dt/gleise_zahlen//hoch/${first_part}_.wav modules/dt/gleise_zahlen/hoch//$second_part.wav 2&>1 1>/dev/null
|
|
|
|
elif [[ $length -eq 4 ]]; then
|
|
# Split a 4-digit number into 2 + 2
|
|
first_part="${AbfahrtUhr:0:2}" # First two digits
|
|
second_part="${AbfahrtUhr:2:2}" # Last two digits
|
|
|
|
printf "${RED}$first_part Uhr${NC}\n"
|
|
mpv modules/dt/zeiten/stunden/hoch/${first_part}.wav 2&>1 1>/dev/null
|
|
printf "${RED}$second_part${NC}\n"
|
|
mpv modules/dt/zeiten/minuten/hoch/$second_part.wav 2&>1 1>/dev/null
|
|
|
|
else
|
|
echo "Please enter a number with at least 3 digits."
|
|
fi
|
|
|
|
}
|
|
verspaetung_45() {
|
|
printf "${RED}voraussichtlich 45 Min später eintreffen${NC}\n"
|
|
#vorraussichtlich 45 Minuten später eintreffen
|
|
mpv modules/dt/zeiten/verspaetung_an/045.wav 2&>1 1>/dev/null
|
|
}
|
|
|