Re: Little script help please
Hello,
On 08-Sep-00 Mervyn Jack wrote:
> Our programmer, Andrew, tells me the problem is with the lines...
> if [ $hessian_colour="twotone" ]; then
>
> The "=" set's $hession_colour to twotone and returns a TRUE to say the
> operation
> has been successful.
> You need to use a "==" to compare the two values.
> For String comparisons, you should really use the word "eq".
The script looks like regular Bourne shell script, and you do not need the
== in shell, you do in "C" though. Also I only use the -eq -ne -gt -lt
qualifiers for numeric comparisons.
I would also put the variables in double quotes as well as the constants, since
if the variable is not set, you will get an error without them.
Bill Suetholz
>
>
> Mervyn
>
>
> ridgey wrote:
>
>> Below is a script I am writing, what it does it take in values from webpage
>> and basically just write them to a file. What I am trying to do is: there
>> is heap of different sections on the page, hessian, linen and more to be
>> added. I want the script to ONLY write to file the section that is selected
>> and leave the rest out. I think maybe I have done something wrong with the
>> ifs as it writes every field to the file when I have specified no values so
>> the file should be blank.
>> Any help greatly appreciated.
>>
>> Ridgey
>>
>> /home/httpsd/temp/countryhats
>> fi
>> if [ $hessian_colour="twotone" ]; then
>> echo "Hessian Selected" >> /home/httpsd/temp/countryhats
>> echo "Twotone - First Tone Selected = $h_tone_one" >>
>> /home/httpsd/temp/countryhats
>> echo "Twotone - First Tone Selected = $h_tone_two" >>
>> /home/httpsd/temp/country
>> fi
>> if [ $linen_colour="onecolour" ]; then
>> echo "Linen Selected" >> /home/httpsd/temp/countryhats
>> echo "One Colour - Colour Selected = $l_colour" >>
>> /home/httpsd/temp/countryhats
>> fi
>>
>> --
>> To UNSUBSCRIBE, email to debian-isp-request@lists.debian.org
>> with a subject of "unsubscribe". Trouble? Contact
>> listmaster@lists.debian.org
>
> --
> Mervyn Jack, Technical Director, Country Netlink Pty Ltd.
> PO Box 529, Cobram, Vic. Australia, 3644
> Ph +61 3 5871 1000 Fax +61 3 5871 1874 Mobile 0409 960 520
> mailto:mervynj@cnl.com.au http://www.cnl.com.au ICQ 354419
>
>
>
> --
> To UNSUBSCRIBE, email to debian-isp-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
----------------------------------
E-Mail: wsuetholz@centonline.com
Date: 12-Sep-00
Time: 10:31:37
This message was sent by XFMail
----------------------------------
Reply to: