Subject: When Quotes Attack

From: Shlomi Fish <[email-masked]>
Date: Sat, 11 Oct 2003 22:52:51 +0200 (IST)

I blissfully wrote the following lines in a bash script that served as
a test suite for Quad-Pres:

for lang1 in "" "he-IL" ; do
    for char1 in "" "utf-8" ; do
        for lang2 in "" "en-GB" ; do
            for char2 in "" "iso-8859-8" ; do
                perform_test $lang1 $char1 $lang2 $char2
            done
        done
    done
done

Where perform_test is a function that takes 4 arguments. And then it did
not work properly, and I banged my head on the wall trying to find out
why?

Can you spot the bug?

The problem is that if unquoted the variables expand into the empty string
and a command line containing this does not treat them as a distinct
argument. (rather as an empty space). Adding quotes around each argument
solved the problem.

You can find the complete (now working code) here:

http://stalker.iguide.co.il:8080/svn/lm-solve/quad-pres/trunk/installer/tests/

Regards,

	Shlomi Fish

$There $is $No IGLU Cabal!

----------------------------------------------------------------------
Shlomi Fish        [email-masked]
Home Page:         http://t2.technion.ac.il/~shlomif/

An apple a day will keep a doctor away. Two apples a day will keep two
doctors away.

	Falk Fish