PMFJI, but isn't the shell script string equality compare operator a double equal sign, "==", following the C convention?
-----Original Message----- From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of Paul Gilmartin Sent: Friday, February 11, 2022 5:51 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Coding IF statement in BPXBATCH shell On Fri, 11 Feb 2022 18:33:41 -0400, Kurt J. Quackenbush wrote: > >Try like this: > >pet=dog; >if [ $pet -eq "dog" ]; then > "-eq" compares numbers; "=" compares strings. Example: 537 $ [ 00042 -eq 42 ]; echo $? 0 538 $ [ 00042 = 42 ]; echo $? 1 539 $ And "$pet" needs to be quoted lest a user sneak in: pet="Tasmanian Devil" > echo "feed dog"; >else > echo "feed cat"; >fi; -- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN