LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-22-2015, 04:13 AM   #1
anjilinux
LQ Newbie
 
Registered: Oct 2015
Posts: 1

Rep: Reputation: Disabled
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
}
 
Old 10-22-2015, 04:26 AM   #2
ChrisAbela
Member
 
Registered: Mar 2008
Location: Malta
Distribution: Slackware and Debian
Posts: 517

Rep: Reputation: 108Reputation: 108
Try this:

Quote:
call_db2 call $SCHEMA_NAME.ALL_DATA_PURGE1\('$SCHEMA_NAME',$DAYS,$COMMIT_COUNT\);
 
Old 10-22-2015, 06:47 AM   #3
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
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.
 
Old 10-22-2015, 10:25 AM   #4
atjurhs
Member
 
Registered: Aug 2012
Posts: 190

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

Last edited by atjurhs; 10-22-2015 at 10:26 AM.
 
Old 10-22-2015, 07:57 PM   #5
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,691

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] syntax error near unexpected token `)' Mordillo98 Linux From Scratch 4 05-16-2012 03:41 PM
syntax error near unexpected token `fi' divyashree Programming 2 09-30-2009 09:51 AM
Syntax error near unexpected token fi Nortekman Linux - Newbie 8 02-27-2009 03:48 PM
syntax error near unexpected token Aigarzs Linux - Newbie 3 01-12-2008 03:39 PM
syntax error near unexpected token `else' josedias Programming 3 09-11-2006 07:09 PM


All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration