Re: Little script help please
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".
> 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.
> if [ $hessian_colour="twotone" ]; then
> echo "Hessian Selected" >> /home/httpsd/temp/countryhats
> echo "Twotone - First Tone Selected = $h_tone_one" >>
> echo "Twotone - First Tone Selected = $h_tone_two" >>
> if [ $linen_colour="onecolour" ]; then
> echo "Linen Selected" >> /home/httpsd/temp/countryhats
> echo "One Colour - Colour Selected = $l_colour" >>
> To UNSUBSCRIBE, email to firstname.lastname@example.org
> with a subject of "unsubscribe". Trouble? Contact email@example.com
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:firstname.lastname@example.org http://www.cnl.com.au ICQ 354419