2
0
mirror of https://github.com/kazhala/dotbare synced 2024-11-19 15:25:46 +00:00
dotbare/helper/get_confirmation.sh
2020-04-14 17:17:42 +10:00

23 lines
529 B
Bash

#!/bin/bash
#
# confirmaiton helper
#######################################
# Helper function to get user confirmation
# Globals:
# None
# Locals:
# ${confirm}: user confirmation status
# Arguments:
# $1: confirmation message to show during confirm
# Outputs:
# ${confirm}: y or n indicating user response
#######################################
function get_confirmation() {
local confirm
while [ "${confirm}" != 'y' ] && [ "${confirm}" != 'n' ]; do
read -r -p "$1(y/n): " confirm
done
echo "${confirm}"
}