Skip to content
Snippets Groups Projects
Commit ac199ba7 authored by Alberto LIVIO BECCARIA's avatar Alberto LIVIO BECCARIA
Browse files

Aggiunta funzione per chiedere conferma all'utente

parent c4227b48
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,28 @@ doesAnyFileExist () {
# IFS="$OLDIFS"
#}
function askYesNo () {
local question=$1
local default=$2
local options=""
if [[ $default = true ]]; then
options="[Y/n]"
default="y"
else
options="[y/N]"
default="n"
fi
while true; do
read -p "$question $options " -n 1 -s -r REPLY
echo ${REPLY}
case $REPLY in
[yY]) echo ; return 0 ;;
[nN]) echo ; return 1 ;;
*) printf " \033[31m %s \n\033[0m" "invalid input"
esac
done
}
declare -A vms
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment