Ask for confirmation in install script

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2019-09-10 18:55:59 +02:00
parent 5c401ac0f6
commit 1c7b6a328a
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
2 changed files with 52 additions and 34 deletions

View file

@ -28,6 +28,7 @@ RED='\033[31m'
BLUE='\033[34m'
YELLOW='\033[33m'
BOLD="$(tput bold)"
NORMAL="$(tput sgr0)"
#######################################
# Helper functions
@ -56,4 +57,15 @@ function print_section() {
function print_log() {
echo -e " • $1"
}
function ask_prompt() {
read -p "${BOLD}${1} (y/n): ${NORMAL}" -n 1 -r
echo ""
if [[ ${REPLY} =~ ^[^yY]$ ]]; then
return 1
fi
return 0
}