Path: 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 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