All pastes #566367 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-14 12:45 UTC
rendered paste body
#
#
#       function which gets a yes or a no, returns "y" or "n"
#
#
function getyesno {
        noans=t
        prompt="$*"
#
        while [ $noans = t ] ; do
                read intext?"${prompt} ( Must use y for yes, n for no )"
                if [ "x$intext" = xy ] ; then
                        echo y
                        noans=f
                elif [ "x$intext" = xn ] ; then
                        echo n
                        noans=f
                fi
        done
}
typeset -xf getyesno