Open
Description
yn_yes
is a function that takes a string and then acts as a prompt. The implementation could look like this:
functuion yn_yes() {
read -p "$1 [Y/n]" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then return 1; fi
}
A use case might be:
if yn_yes "do you really want to do xyz?"
then
proceed
fi
exit
And yn_no
is the default no case.
Metadata
Metadata
Assignees
Labels
No labels