May be this

#!/bin/sh

get_answer ()
{
    value=$1
    question=$2
    if [ "${value}" = "ask" ]; then
        echo -n "$question"
        read value
    fi
    ANSWER=$(echo ${value} | grep -o -e '[YyNn]' | sed -e 's/Y/y/' -e 's/N/n/')
}

get_answer ask "My question?"


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.