Problem with a function in a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with a function in a shell script
# 1  
Old 05-21-2008
Problem with a function in a shell script

Hi,
I am trying to write a function in the shell script .
This function accepts two parameters. It is as following:

set_cache(i_SEQ_NAME,I_cache_size)
{
_sqlplus "BEGIN alter_seq_cache(i_SEQ_NAME, I_cache_size); END;"

}

_sqlplus is another function and has been working working.
However this some problem with set_cache function. I am getting the following error
`(' is not expected at 1st line.

Please help!!
Thanks
# 2  
Old 05-21-2008
Quote:
Originally Posted by neeto
Hi,
I am trying to write a function in the shell script .
This function accepts two parameters. It is as following:

set_cache(i_SEQ_NAME,I_cache_size)
{
_sqlplus "BEGIN alter_seq_cache(i_SEQ_NAME, I_cache_size); END;"

}

_sqlplus is another function and has been working working.
However this some problem with set_cache function. I am getting the following error
`(' is not expected at 1st line.

Please help!!
Thanks
I think you have a useless semicoloumn.
# 3  
Old 05-21-2008
No this _sqlplus funtion executes the function in the databease. I guess semicolon is required.
# 4  
Old 05-21-2008
Can you try the below, entering the parameters manually to the script?

set_cache()
i_SEQ_NAME=$1
I_cache_size=$2
{
_sqlplus "BEGIN alter_seq_cache(i_SEQ_NAME, I_cache_size); END;"

}
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

2. Shell Programming and Scripting

Bash script: problem with a function which use colors

Hello guys :) I've a some issue with a function which use the bash colors in my script. An example : #!/bin/bash set -x log_in(){ host="srv1" remote_files="log/" LOG_FILE="logfile" green='\033]; then color_in_red=("${red}"$2"${none}") echo -e... (2 Replies)
Discussion started by: Arnaudh78
2 Replies

3. Shell Programming and Scripting

What is the function of the following lines at the top of a shell script file: Directory and Script?

The file starts like this: Directory: <path to the script> Script: <script fife name> #!bin/ksh ##Comments <actual script> What is the use of the first two lines in the script? What if I save the file without them? What will be the effect? They are not comments. Im very new to this,... (4 Replies)
Discussion started by: remytom
4 Replies

4. Shell Programming and Scripting

Shell Script function to use script name for log file output

Hi Team - I"m very new to Shell Scripting so I have a rather novice question. My forte is Windows Batch Scripting so I was just wondering what the Shell Script equivalent is to the DOS command %~n? %~n is a DOS variable that dispayed the script name. For instance (in DOS): REM... (11 Replies)
Discussion started by: SIMMS7400
11 Replies

5. Shell Programming and Scripting

Call a function in shell script from another shell script

I've 2 shell scripts viz., CmnFuncs.ksh and myScript.ksh. 1st script contains all common functions and its code is as below: $vi CmnFuncs.ksh #!/bin/ksh RunDate() { .... .... export Rundt=`date +%Y%m%d` } 2nd script is invoking the above one and I expect to use the RunDt variable... (8 Replies)
Discussion started by: njny
8 Replies

6. Shell Programming and Scripting

Problem while Invoke Shell Script function from Java Program

Hi, I have create a Shell Script, with one function. I want to call the script file in Java Program. It working fine. but the problem is the function in the Shell Script is not executed. Please suggest me, Regards, Nanthagopal A (2 Replies)
Discussion started by: nanthagopal
2 Replies

7. Red Hat

how to call a particular function from one shell another shell script

please help me in this script shell script :1 *********** >cat file1.sh #!/bin/bash echo "this is first file" function var() { a=10 b=11 } function var_1() { c=12 d=13 (2 Replies)
Discussion started by: ponmuthu
2 Replies

8. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

9. Shell Programming and Scripting

Problem with function in a script

Hi All, What is the problem with the following script: function mmdd { dd=$2 case $1 in "Jan") mm=01;; "Feb") mm=02;; "Mar") mm=03;; "Apr") mm=04;; "May") mm=05;; "Jun") mm=06;; "Jul") mm=07;; "Aug") mm=08;; "Sep") mm=09;; "Oct") mm=10;; "Nov") mm=11;; "Dec") mm=12;; *)... (3 Replies)
Discussion started by: Hiso
3 Replies

10. Shell Programming and Scripting

Problem with function script.

Need an extra set of eyes. Can't find function. Can someone help, please. Thanks echo " Is this the correct list of tapes to eject (y/n)?" read option echo $option case $option in y|Y) TAPE_ROUTINE;; ... (3 Replies)
Discussion started by: gzs553
3 Replies
Login or Register to Ask a Question