Script question

Lt. Commander listmgr at antennex.com
Mon Jun 22 00:57:30 UTC 2015


Sheesh! Here's the script:
#get_yes_no() {
        while true
        do
                echo -n "$1 (Y/N) ? " 
                read -t 30 a
                if [ $? != 0 ]; then
                        a="No";
                        return;
                fi
                case $a in
                        [Yy]) a="Yes";
                              return;;
                        [Nn]) a="No";
                              return;;
                        *);;
                esac
        done
#}

get_yes_no "Do you want to continue......"

[ $a = 'No' ] && exit 1

______________________________________________

Hi list!

The script guys were very helpful in smoothing out my sh shell script and it
with other script calls are doing the job I needed.

BUT! I took the snippet below to use as an "yes/no" intro to one of the
calls. It must have aged as is because it complains about badly placed "()s"
right near the top of the intro and I suspect it won't agree with another
line further down either.

Perhaps a hint from the experts as to how to change the problem?

Thank you!

Jason




More information about the freebsd-questions mailing list