201 Syntax Error
Posted in 2018
Topics: Server Administration
Does anyone know what the 2 does in this code or where my syntax error issue
is coming from? I'm trying to figure out where the syntax error is. I ran the
code directly with dbaccess, and it doesn't mention any issues.
Here is the code:
#!/bin/ksh
. /home/informix/informix.env
$INFORMIXDIR/bin/dbaccess openbet <<EOF
2>>/opt/informix/update_statistics_job_output.out
update statistics low;
update statistics for procedure;EOF
Here is the error:
Database selected.
Statistics updated.
201: A syntax error has occurred.
Error in line 1Near character position 1
201: A syntax error has occurred.
Error in line 1Near character position 1
Database closed.
Hi Benji.
The "2" denotes redirection of standard error only. Your syntax works fine on
Linux with both ksh and bash. If you are on HP-UX or AIX, perhaps the EOF
marker must be at end of line for the "<<" notation to work, in which case
this should fix it:
($INFORMIXDIR/bin/dbaccess openbet 2>>/opt/informix) <<EOF
/update_statistics_job_output.out
update statistics low;
update statistics for procedure;EOF
The brackets may not be necessary.
Regards,
Doug Lawry
Hi thanks Doug. I fixed my issue. We had comments inside the here doc, and I
don't think dbaccess liked them in there possibly