Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jun 2015 16:36:36 -0500
From:      "Lt. Commander" <listmgr@antennex.com>
To:        "'Lt. Commander'" <listmgr@antennex.com>, "'Patrick Hess'" <patrickhess@gmx.net>, <freebsd-questions@freebsd.org>
Subject:   RE: Script question
Message-ID:  <BAY404-EAS42803D52F7023B63CB38AFFCCA20@phx.gbl>
In-Reply-To: <BAY404-EAS3520468CFD04B6982A1487BCCA20@phx.gbl>
References:  <BAY182-W89C2924F4BDF0D2BD3810DF4BB0@phx.gbl> <BAY404-EAS148D4B304BB066F07E84004CCB90@phx.gbl> <20150615015516.b3ea7633.freebsd@edvax.de> <2609852.Pc7nSdcYla@desk8.phess.net> <BAY404-EAS3520468CFD04B6982A1487BCCA20@phx.gbl>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BAY404-EAS42803D52F7023B63CB38AFFCCA20>