TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ME@MYMAILSVR.ORG
from: SCOTT ALFTER
date: 2020-07-20 18:27:00
subject: Re: Strange construct in

In article ,
John Carter   wrote:
>The problem arises on the IF ststement.  The error is too many
>parameters.  It looks like the "-a" is something I have never seen in
>an IF statement and I can find no reference to it anywhere.
>
>if [ ${GOV} = "ondemand" -a ${FORCE} = "1" ]

-a is the logical AND operator.  What's likely causing an error is if either
$GOV or $FORCE are empty, the command parses out to something like this:

if [ = "ondemand" -a = "1" ]

That obviously makes no sense.  In any bash comparison, quote your
variables:

if [ "${GOV}" = "ondemand" -a "${FORCE}" = "1" ]

That way, if they're empty, the command parses like this:

if [ "" = "ondemand" -a "" = "1" ]

which evaluates as false, instead of returning an error.

  _/_
 / v \ Scott Alfter (remove the obvious to send mail)
(IIGS( https://alfter.us/           Top-posting!
 \_^_/                              >What's the most annoying thing on Usenet?

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.