Wie man die Skriptfortsetzung mit Ja/Nein in Bash auf der Linux-Befehlszeile bestätigt.

Ich habe das folgende Skript klarer und einfacher zu verwenden gemacht.
How do I prompt a user for confirmation in bash script? - Stack Overflow
ok(){
: <<< '
yes or no prompt
e.g. printf "The file alredy exist here. Overwrite it? " ; ok && echo y || echo n
'
read -n 1 -r ; [[ $REPLY =~ ^[Yy]$ ]] && return 0 || return 1
}
Verwendungsbeispiel
printf "The file alredy exist here. Overwrite it? " ; ok && echo y || echo n