LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   unexpected end of file (https://www.linuxquestions.org/questions/linux-newbie-8/unexpected-end-of-file-852838/)

valerio orfano 12-28-2010 12:15 PM

unexpected end of file
 
i ve been struggling for 2 days now and cant figure out the soluton.

this is my whole script

sqlplus SIEBEL/SIEBEL@oltpsia << EOF
set serveroutput on size 1000000
set heading off
set feedback off
Insert into EIM_ZIPCODE_BADEIM (select sysdate, 'TOPONOMASTICA','','', c.* From EIM_ZIPCODE c where c.if_row_stat not in ('IMPORTED','DUP_RECORD_EXISTS'));
commit;
EXIT
EOF
#echo $?
if [ $? = 0 ]; then echo "OK" else echo "Errore" fi


the sql is properly executed but the if condition not, and i keep receiving the error message "unexpected end of file"

Where is the error, please help me out

BR valerio

AlucardZero 12-28-2010 12:28 PM

Well, for starters,
Code:

sqlplus SIEBEL/SIEBEL@oltpsia << EOF
is invalid. Remove the space before EOF.

Also, is this bash, ksh, what?

valerio orfano 12-29-2010 04:01 AM

it's bash.

catkin 12-29-2010 05:12 AM

Did the << EOF to <<EOF change fix it?

crts 12-29-2010 07:16 AM

Quote:

Originally Posted by valerio orfano (Post 4205598)
if [ $? = 0 ]; then echo "OK" else echo "Errore" fi


the sql is properly executed but the if condition not, and i keep receiving the error message "unexpected end of file"

You are missing a semicolon. Try


if [ $? = 0 ]; then echo "OK" else echo "Errore" ; fi


All times are GMT -5. The time now is 06:33 PM.