LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   syntax error near unexpected token `(' (https://www.linuxquestions.org/questions/linux-newbie-8/syntax-error-near-unexpected-token-%60-4175556856/)

anjilinux 10-22-2015 04:13 AM

syntax error near unexpected token `('
 
I have this function to call this in my .sh script file, getting the syntax error near unexpected token `('. Please advise if any change required to replace/bypass the character (


function purge_data
{
call_db2 SET SERVEROUTPUT ON
call_db2 call $SCHEMA_NAME.ALL_DATA_PURGE1('$SCHEMA_NAME',$DAYS,$COMMIT_COUNT);
call_db2 SET SERVEROUTPUT OFF
}

ChrisAbela 10-22-2015 04:26 AM

Try this:

Quote:

call_db2 call $SCHEMA_NAME.ALL_DATA_PURGE1\('$SCHEMA_NAME',$DAYS,$COMMIT_COUNT\);

zhjim 10-22-2015 06:47 AM

might be that sh interprets everything after the $ as the variable name.

Try

Quote:

${var_name}.ALL_DATA_PURGE1($arg1, $arg2, $arg3);
Also keep in mind that everything between '' will be taken as is and not interpreted by the shell. Use "" for this.

atjurhs 10-22-2015 10:25 AM

hey :) i get that error too when running some of my bash scripts when vars going between dir levels, i think ???

berndbausch 10-22-2015 07:57 PM

It's not clear if the strings that start with $ are supposed to be shell variables or DB2 constructs.

If they are shell variables, this: '$SCHEMA_NAME' looks wrong.
If they are not shell variables, the $SCHEMA_NAME in this: call $SCHEMA_NAME.... will be replaced by the empty string, which looks wrong as well.


All times are GMT -5. The time now is 11:25 AM.