[lug] More script questions

Tom Tromey tromey at cygnus.com
Thu Apr 27 18:10:03 MDT 2000


>>>>> "winrip" == winrip  <winrip at speakeasy.org> writes:

winrip> Anyway I got this far but I can't figure this last error out. 

You really want to read the sh manual.

winrip> testl1 = 0
winrip> testl2 = 1

No spaces.  "testl1=0"

winrip>  while [testl1 != testl2]

You need spaces and dollar signs, and a "do".  "!=" is string
comparison.  I would write:

    while [ $testl1 -ne $testl2 ]; do

winrip>     if [p1 + 2 == p2]; then

if [ `expr $p1 + 2` -eq $p2 ]; then

winrip>     testl1 = 0 

testl1=0

winrip>    testl2 = 1 

testl2=0

winrip> do 

Delete

winrip> sleep 5
winrip> done


Also I don't think your loop will ever terminate.  If you intent to
exit the loop on the mail-sending branch, it is probably more
idiomatic to use "while true" and a "break" in the "if".

Tom




More information about the LUG mailing list