I have a shell script, when I execute it, I get the error
syntax error at line 34 : `<<' unmatched in ksh script column_name=`sqlplus -s $BASE_DB_CONN<<!! WHENEVER SQLERROR exit ROLLBACK set SQLPROMPT '' set heading off set pagesize 1000 set linesize 5000 set feedback off set define on set verify off @smm9_stream_map.sql $STREAM_NAME $FIELD_NAME" exit !!`;
To my surprise the same thing works in the while loop altered script as below
while [ $a -lt ${NO_LOOP} ] do column_name=`sqlplus -s $BASE_DB_CONN<<!! WHENEVER SQLERROR exit ROLLBACK set SQLPROMPT '' set heading off set pagesize 1000 set linesize 5000 set feedback off set define on set verify off @smm9_stream_map.sql $STREAM_NAME $FIELD_NAME" exit !!`; a=`expr $a + 1` done
Why does the second script work but not the first one?