common.sh: introduce confirm()
bypass_checksum tends to be mistakenly applied Signed-off-by: fukiame <fukiame@proton.me>
This commit is contained in:
parent
0fe061a9ca
commit
ffb3a842fa
1 changed files with 9 additions and 0 deletions
|
|
@ -91,3 +91,12 @@ warn() {
|
|||
err() {
|
||||
echo -e "\033[31m[$(date +"%H:%M:%S:%2N")] [ERROR] $1\033[0m"
|
||||
}
|
||||
|
||||
confirm() {
|
||||
read -rp "$1
|
||||
Press Y to confirm, press any other keys to cancel: " val
|
||||
case "$val" in
|
||||
Y|y|yes|Yes) : ;;
|
||||
*) return 69 ;;
|
||||
esac
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue