shell script calling problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script calling problem
# 1  
Old 03-24-2006
shell script calling problem

Hi all,

I am calling one shell script from other ...as follow

---calling_proc---code
line_no=10
proc_name='test'
echo "set verify off feedback off pagesize 0
select count(*) from tp_mpolicy2 " | sqlplus -s/@CMKT | read cnt
if [ $? -ne 0 ]; then
export $line_no $proc_name
global_proc $line_no $proc_name
else
echo Success
fi

----global_proc ---code
echo $line_no $proc_name
-----------------------------------

But when I run calling_proc it gives me error as follows
calling_proc[9]: 10: is not an identifier

If any ideas Please help asap

Thanks
# 2  
Old 03-30-2006
The problem is that you are misusing the "export" command. This command puts one or more variables into the environment table using the syntax:

export variable1 variable2 ...

In your script, the variable line_no in the line "export $line_no $proc_name" has a value of 10. As the shell expects a list of variables to export and variables have to start with a letter or underscore (_) you get an error. The next line calls the second script with parameters, so just remove the "export ..." line and all should be fine.

cheers
# 3  
Old 03-30-2006
Actual error was 1 more

Quote:
Originally Posted by thestevew
The problem is that you are misusing the "export" command. This command puts one or more variables into the environment table using the syntax:

export variable1 variable2 ...

In your script, the variable line_no in the line "export $line_no $proc_name" has a value of 10. As the shell expects a list of variables to export and variables have to start with a letter or underscore (_) you get an error. The next line calls the second script with parameters, so just remove the "export ..." line and all should be fine.

cheers
Thanks for the help..

But the error in the script was:-
I should have used $1 $2 ...but instead was using $line_no etc.

also as per u export command was not needed at all while passing arguments to the called script..

Thanks....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calling a shell script present on another server using perl script.

Hi, I am working on a sever A. I want to write a perl script to execute a shell script persent on the server B. please help me in this. thanks in advance. (3 Replies)
Discussion started by: anandgodse
3 Replies

2. Shell Programming and Scripting

How we can pass the argument when calling shell script from perl script

Can someone let me know how could I achieve this In one of per script I am calling the shell script but I need to so one thing that is one shell script call I need to pass pne argument.In below code I am calling my ftp script but here I want to pass one argument so how could I do this (e.g:... (5 Replies)
Discussion started by: anuragpgtgerman
5 Replies

3. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

4. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

5. Shell Programming and Scripting

calling problem in perl script

Hi , Here is my piece of code-- main(); sub main { $result = GetOptions ("LogDir=s" => \$LogDir, "Summary" => \$Summary, "Indiviual=s" => \$Individual , "Diagnostics=s" => \$Diagnostics, ... (1 Reply)
Discussion started by: namishtiwari
1 Replies

6. Shell Programming and Scripting

Calling another shell script

Hi there, I have an script reading content of a file and runs whatever command is specified there, as follows #!/bin/bash # Supposed to read from a file that commands are listed to be run # when the server starts for initialization CMD_FILE=/myScripts/startup/task2do.txt if ; then ... (2 Replies)
Discussion started by: james gordon
2 Replies

7. Shell Programming and Scripting

Calling shell functions from another shell script

Hi, I have a query .. i have 2 scripts say 1.sh and 2.sh 1.sh contains many functions written using shell scripts. 2.sh is a script which needs to call the functions definded in 1.sh function calls are with arguments. Can some one tell me how to call the functions from 2.sh? Thanks in... (6 Replies)
Discussion started by: jisha
6 Replies

8. Shell Programming and Scripting

Calling Shell Script

Hello Friends, I have bash script on unix server which i want to call from windows server. Basically i want a command line which will call this script on unix server. Any one has any idea regarding this? Help really appreciated!! Thanks, Roshni. (1 Reply)
Discussion started by: onlyroshni
1 Replies

9. Shell Programming and Scripting

Problem with Calling sql file from shell script

I have created abc.sh file which will set the environment variables (UNIX env variables as well as ORACLE required variables like ORACLE_SID,ORACLE_HOME etc) and then calls a function file which checks for starts some logs and then it will try to execute the .sql file. The .sh, function file are as... (1 Reply)
Discussion started by: sskc
1 Replies

10. Shell Programming and Scripting

Calling shell script ?

hi friends, i'm new to unix and straight away i had to start with the script files. I've a script file which gets called from a menu item on a GUI. This script file again calls .awk file, in performing some tasks , which also generates certain files. I modified the files to generate some... (1 Reply)
Discussion started by: Ravi_Kandula
1 Replies
Login or Register to Ask a Question