Allow 'y', 'yes', and case-insensitive variants for confirmation

This commit is contained in:
Lennart Pieperjohanns 2024-09-29 21:28:24 +02:00 committed by GitHub
parent 6dc4502825
commit 4e09e5a8d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -170,7 +170,8 @@ write_iso(){
printf "%b" "${RED}WARNING: This will erase all data on ${USB_DEVICE}. Are you sure you want to continue? (y/N): ${RC}"
read -r CONFIRMATION
if [ "$CONFIRMATION" != "yes" ]; then
# Convert the input to lowercase and compare
if [ "$(echo "$CONFIRMATION" | tr '[:upper:]' '[:lower:]')" != "yes" ] && [ "$(echo "$CONFIRMATION" | tr '[:upper:]' '[:lower:]')" != "y" ]; then
printf "%b\n" "${YELLOW}Operation cancelled.${RC}"
exit 1
fi
@ -204,4 +205,4 @@ write_iso(){
checkEnv
checkEscalationTool
write_iso
write_iso