Function Bug in script - need help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Function Bug in script - need help
# 1  
Old 06-04-2007
Function Bug in script - need help

My script is erroring with: testtapemgr.sh: FTP_RETURNS: not found
I cannot see what I am doing wrong..when it calls that function from the Volume returns function and says taht FTP_RETURNS is not found and exits out of the script. What am I not seeing here?


#### Return Volume Function Section ############
Volume_Returns()
{
echo "Enter Volumes to be returned"; read input
total_ret=`mminfo -q volume=$input -r volume,location,pool,volretent > $ERVTAPE_RET; cat $ERVTAPE_RET | wc -l`
echo "Is this the volume you would like to return.. $input (y/n)"
total_ret=`expr $total_ret - 1`
echo " Please return the tapes listed"| cat $ERVTAPE_RET
read response
if [ $response = "y" ]; then
echo "Please return the following Tape(s)" >>$ERVTAPE_RET
echo " Please return the tapes listed"| cat $ERVTAPE_RET
RETURN_FLAG="y"
CUT_ERVTAPE_FILE;
#EMAIL_ERV_RET;
FTP_RETURNS

else
echo "incorrect response"; Volume_Returns
exit
fi
}

########################### OFFSITE VOLUMES TO BE RETURNED
FTP_RETURNS()
{
echo "In ftp_ret routine"
echo "$ERVTAPE_RTMP File Transferring to $FTP_HOST.................Return_TAPES"
ftp -n $FTP_HOST <<END_FTP_RET
quote USER $FTP_LOGIN
quote PASS $FTP_PWD
put $ERVTAPE_RTMP
put $RETURN_TAPES_RPT
rename $ERVTAPE_RTMP /export/home/legato/tapemgr/rpts/offsite/returns/ERVTAPE_return.tmp
rename $RETURN_TAPES_RPT /export/home/legato/tapemgr/rpts/offsite/returns/returns_erv.rpt$dat
echo $ERVTAPE_RTMP; echo $RETURN_TAPES_RPT
END_FTP_RET
}
clear
tapemgr_Main_Menu
# 2  
Old 06-04-2007
You must first define the function before calling it.
# 3  
Old 06-04-2007
Not sure what you mean. I did define the function as

FTP_RETURNS()

..see the script where I call the function.
# 4  
Old 06-04-2007
the function should be defined BEFORE it's being CALLED
# 5  
Old 06-05-2007
Gosh...sometimes I am so dense...Thanks for your help!! I guess I have been looking at it too long....duh!! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

Small bug in the Quick Editor function in postbit

Hey, There was a small bug in the Quick Editor function in postbit, but I fixed it (basically a double quote was missing from an element id): <div id="post_message_$post" class="neo-message-area">$post</div> Was <div id="post_message_$post class="neo-message-area">$post</div> Should... (1 Reply)
Discussion started by: Neo
1 Replies

2. Shell Programming and Scripting

Will files, creaetd in one function of the same script will be recognized in another function?

Dear All. I have a script, which process files one by one. In the script I have two functions. one sftp files to different server the other from existing file create file with different name. My question is: Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies

3. Programming

Tweaked getpass() function gives an untraceable bug

I have customized the getpass() as follows: char* my_getpass(const char* str) { struct termios oflags, nflags; static char passwd; /* disabling echo */ tcgetattr(fileno(stdin), &oflags); nflags = oflags; nflags.c_lflag &= ~ECHO; nflags.c_lflag |= ECHONL; ... (3 Replies)
Discussion started by: royalibrahim
3 Replies

4. Shell Programming and Scripting

Sort function UNIX bug ???

Hello there i have a funny behiavor of the sort fonction, i try it out on different Solaris machine and i have the same issue. So i would like to see if there is a rationel explanation here is some data in a file:test.txt ,Test,RSD,RSD_Asset ,Test,RSD,RSD_Credit ,Test,RSD,RSD_Liab... (3 Replies)
Discussion started by: kykyboss
3 Replies

5. Shell Programming and Scripting

Bug in Function Call

Can anybody tell me where is the bug in this below mentioned function call. #The String Search File myString="${LOCATION}/config/stringFile.txt" # Functional Usage function usage() { if ; then echo "************************************************************" ... (5 Replies)
Discussion started by: baraghun
5 Replies

6. 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

7. Shell Programming and Scripting

Help - Bug: A script to compile two types of data files into two temporary files

Dear other forum members, I'm writing a script for my homework, but I'm scratching all over my head and still can't figure out what I did wrong. Please help me. I just started to learn about bash scripting, and I appreciate if anyone of you can point out my errors. I thank you in advance. ... (3 Replies)
Discussion started by: ilove2smoke
3 Replies

8. Shell Programming and Scripting

bash-function with array acting bizarre, bug?

Hello, basically what this script is supposed to do is showing a list of hosts that is given a number, that you will be able to choose from a list. A check is made to verify that the chosen number is within the array and this is where things go bad and I don't know why, bizarre. I've spent... (5 Replies)
Discussion started by: gand
5 Replies

9. Shell Programming and Scripting

Can anyone find a bug in this code?? shell script

I have done a script and IT WORKS JUST PERFECT from command line...but in cron it has problems executing... nawk -F"|" ' { s=substr($104,2,18)} {b ++s} END { for (i in b) print i, b } ' $1 > /path/to/files/TranId_w$2 q=`cat /path/to/files/TranId_w$2 | wc -l` echo $q >... (1 Reply)
Discussion started by: amon
1 Replies
Login or Register to Ask a Question