mirror of https://github.com/kazhala/dotbare
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
529 B
Bash
23 lines
529 B
Bash
5 years ago
|
#!/bin/bash
|
||
|
#
|
||
|
# confirmaiton helper
|
||
|
|
||
5 years ago
|
#######################################
|
||
|
# 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
|
||
|
#######################################
|
||
5 years ago
|
function get_confirmation() {
|
||
5 years ago
|
local confirm
|
||
|
while [ "${confirm}" != 'y' ] && [ "${confirm}" != 'n' ]; do
|
||
|
read -r -p "$1(y/n): " confirm
|
||
5 years ago
|
done
|
||
5 years ago
|
echo "${confirm}"
|
||
5 years ago
|
}
|