aboutsummaryrefslogblamecommitdiffstats
path: root/compose/production/postgres/maintenance/_sourced/yes_no.sh
blob: fd9cae161435e5292a26785ccc7a09551801b6de (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                              
#!/usr/bin/env bash


yes_no() {
    declare desc="Prompt for confirmation. \$\"\{1\}\": confirmation message."
    local arg1="${1}"

    local response=
    read -r -p "${arg1} (y/[n])? " response
    if [[ "${response}" =~ ^[Yy]$ ]]
    then
        exit 0
    else
        exit 1
    fi
}