Skip to content

Add yn_yes and yn_no #4

Open
Open
@ChillerDragon

Description

@ChillerDragon

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions