Re: ksh-Script
Michael Schwendt <[email protected]>
| Newsgroups | gmane.linux.redhat.general.german |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 01 Nov 2004 07:58:01 +0100, Gliebe Richard [riglEDV.at] wrote: > [...] > #!/bin/ksh > echo "\tDo you want to continue ? <y/n> \c" > read answer > if [ $answer != y ] > then > echo "exiting......" > echo "... type ENTER ..." > read a > exit 1 > else > echo > echo "Going on ..." > echo > fi > [...] > > d.h. NUR wenn mit "y" beantwortet wird, darf das Script weiterlaufen. > Soweit so Gut. > ABER: fällt man mit dem Kopf so um 3 Uhr in der Früh auf die "ENTER" > Taste, kommt folgende Meldung, und das Script geht zum nächsten Step: > > [...] > Do you want to continue ? <y/n> > ./xx[12]: test: argument expected > > Going on ... > [...] Weil $answer dann leer ist und die if-Abfrage zu if [ != y ] wird. > Weiss jemand wie man das Unterbinden kann (eventuell mit "trap",...) ? z.B. if [ "$answer" != "y" ] -- Fedora Core release 2 (Tettnang) - Linux 2.6.8-1.541 loadavg: 0.17 0.28 0.19 _______________________________________________ redhat-list-de mailing list [email protected] https://www.redhat.com/mailman/listinfo/redhat-list-de
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBhhgb0iMVcrivHFQRAmudAJ9qTffSWi7XWJAKJofFsULxG/Bo3gCeLdnr IGBWuLpAmmpq4+0aVTt7CtM= =Iquy -----END PGP SIGNATURE-----