1
0
Fork 0
mirror of https://github.com/JackHack96/EasyEffects-Presets.git synced 2024-10-16 11:40:46 +00:00

Merge pull request #25 from Jojodicus/patch-1

handle invalid input (fix #22)
This commit is contained in:
Matteo Iervasi 2022-05-07 18:22:16 +02:00 committed by GitHub
commit ac0228da6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,15 +22,19 @@ check_impulse_response_directory() {
}
read_choice() {
CHOICE=""
while [[ ! $CHOICE =~ ^[1-5]+$ ]]; do
while :; do
read -r CHOICE
if [ "$CHOICE" -lt 1 ] || [ "$CHOICE" -gt 5 ]; then
echo "Invalid option! Please input a value between 1 and 5!"
if [ -z "$CHOICE" ]; then
CHOICE=1 #default
fi
if [[ $CHOICE =~ ^[1-5]+$ ]]; then
break
fi
echo "Invalid option! Please input a value between 1 and 5!"
done
}
install_menu(){
echo "Please select an option for presets installation (Default=1)"
echo "1) Install all presets"