Re: how dbaccess using in FOR circle of UNIX script
Posted in 1998
The "EOF" must be flush left (it is defined as a label
to the shell and must start in column one). Everything else is fluff.
-d
Avi Abrami wrote in message <34BC7CAF.5C6031D7@telegate.co.il>...
>jjdai@pek-co.cn.dhl.com wrote:
>
>> I want to use a for circle to change a variable in a
>> sql statement but system tell me the EOF not matched
>> if I donot use for circle the statement will run
>> correctly. can you help me?
>> example:
>> for i in `cat station_name`
>> do
>> dbaccess DBNAME <<EOF
>> select statement
>> EOF
>> done>> the system warning that the EOF not matched
>>
>> -------------------==== Posted via Deja News ====-----------------------
>> http://www.dejanews.com/ Search, Read, Post to Usenet
>
> Your problem is the indentation in the "for" LOOP (not 'circle').
>The code should be as follows:
>
>for i in `cat station_name`
> do
> dbaccess DBNAME <<EOF
>select statement>EOF
>done
>
>i.e. all code following the EOF should not be indented - it should start
>from the left.
>
>HTH
>Avi.
>
>************************************************************************
> /\\ \\ /| Avi Abrami, Analyst/Programmer, Telegate Ltd.
> /__\\ \\ / | 7 Haplada Street, Or-Yehuda, ISRAEL
>/ \\ \\/ | Phone:+972-3-5388717 Fax:+972-3-5335877
eMail:avia@telegate.co.il
>
>
>