Re: how dbaccess using in FOR circle of UNIX script
Posted in 1998
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 statementEOF
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