🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1314

Re: IF syntax

#1314
From: Wai Yeung
Date: Sat, 01 Dec 1990 23:05
24 lines
969 bytes
In article <15796@brahms.udel.edu>, jon@brahms.udel.edu (Jon Deutsch) writes:
> 
> #!/bin/sh
> if [$temp != '']  then
>         echo 'remote-caller' >> .people;
> else
> 	echo 'inside-caller' >> .people;
> fi
> 
The "then" has to be on the next line. Also, for [ ... ] to check for an
empty string, it isn't necessary to compare with "" (or '').

The following should work.
#
#!/bin/sh
if [ "$temp" ] # Note the quotes
then
    echo 'remote-caller' >> .people
else
    echo 'inside-caller' >> .people
fi
#

Chee Wai
Technical Details
Message-ID: <707@spinifex.eecs.unsw.oz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!metro!usage.csd.unsw.oz.au!spinifex!cheewai
References: <15796@brahms.udel.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!metro!usage.csd.unsw.oz.au!spinifex!cheewai
From: cheewai@spinifex.eecs.unsw.oz (Wai Yeung)
Newsgroups: comp.unix.programmer
Subject: Re: IF syntax
Message-ID: <707@spinifex.eecs.unsw.oz>
Date: 1 Dec 90 23:05:00 GMT
References: <15796@brahms.udel.edu>
Organization: EE & CS, Uni N.S.W., Sydney, Australia
Lines: 24