Invoke script within a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Invoke script within a script
# 1  
Old 03-23-2005
Invoke script within a script

I have a shell script, and I am trying to invoke another shell script from within this shell script, but it just doesn't want to work for me.

The name of the script is "extractSENDER.csh"

Here's what I've tried in my script:
1) extractSENDER.csh and `extractSENDER.csh`
2) echo extractSENDER.csh and `echo extractSENDER.csh`
3) echo `extractSENDER.csh
4) set xxx = "echo extractSENDER.csh"
echo xxx

I could sit here forever, I don't even know what I haven't tried.

Can anyone help please?
# 2  
Old 03-23-2005
By the way, the only thing the script that I am trying to invoke does is: it reads a mail file, extracts the sender, and saves the senders email address to a file named SENDER.

The script works fine if I invoke it myself from a command prompt, its just not working when trying to invoke it within my other script.
# 3  
Old 03-23-2005
in the same directory:

./extractSENDER.csh

or preferably:

/full/path/to/extractSENDER.csh
# 4  
Old 03-23-2005
if the script you're trying to execute [extractSENDER.csh] is a CSH script, make sure that you specify the correct path to the CSH interpreter in the first line of this script. Something like this for extractSENDER.csh:
Code:
#!/bin/csh
....... the rest of the script.......

When you say 'it just doesn't want to work for me', what do you actually see when you try it? Any error messages?
# 5  
Old 03-23-2005
rebor's answer was on the money.

Its a script that is invoked upon the arrival of an email message, and processes some information. I would basically get an error message back where I sent the test email giving me errors that occured while the script tried to run.

I got one more question..........for today Smilie

Now I'm trying to invoke another script, but this script has parameters, and doesn't seem to work like the other script invokation, which didn't take any parameters. Maybe I need to double-check my code. But just in case, would i call the script the same way, without any quotes or anything?
Here is how I'm calling it at the moment:

/path/to/script $email_name $email_domain

Does this look right?

Thanks for your help.
# 6  
Old 03-23-2005
That does look correct.

I always prefer to use ${} for variables.

/path/to/script ${email_name} ${email_domain}
# 7  
Old 03-24-2005
I don't know what is happening. Let me give a little scope of my problem:
1) An email is received, and it is forwarded to a shell script.
2) the main script copies entire email contents to a file
3) the main script calls another script to extract the email address of the sender (the previous problem that I mentioned)
4) the main script then calls another script to validate that email address (I have a text file that contains all of the valid emails), and the other script also writes some information such as the users name, etc, to a file name OWNER

This is where I'm having a problem now. If I invoke the main script (the same script invoked when an email is received) from the command prompt, it works fine. But when an email is received, and the main script is invoked, everything works, except #4. It seems like its sending empty strings as the parameters to the script (I tried outputing the values of the variables I'm passing as parameters, and they have the correct values in the main script. Then I also output the variables in script that is invoked, but it outputs empty lines)

I dont even know how to ask my question, I'm just venting now I guess. If you have any suggestions for me, please throw'em at me, if not, thanks for reading.

By the way, here's how I've tried calling the script from within the main script:
/path/to/script ${arg1} ${arg2}
/path/to/script `echo ${arg1} ${arg2}`

Maybe I just need to take a break, and look at it again, maybe I'm just missing something.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Depend on Script message needs to be invoke anothe script

I have script below #! /bin/bash if then echo "JBoss is NOT running" else echo "JBoss is running" fi If JBoss is NOT running need to be invoke another script i.e jboss startup script /home/vizion/Desktop/jboss-4.2.3.GA/bin/run.sh script from other script not... (5 Replies)
Discussion started by: Chenchireddy
5 Replies

2. Shell Programming and Scripting

Script of invoke an email program

Is it possible that a shell script invokes a windows mailing application like Lotus Notes and creates a mail and sends it ? (2 Replies)
Discussion started by: csrohit
2 Replies

3. Emergency UNIX and Linux Support

invoke one script based on previous script execution

I am database guy and not very good at shell scripts. I am seeking help to sharp my script coding. I have 5 scripts 1. master script. I use this one to call other four scripts to do database work. 2. db_backup_1 and log_backup_1 3. db_backup_2 and log_backup_2 in master script, I want to... (4 Replies)
Discussion started by: duke0001
4 Replies

4. Shell Programming and Scripting

Invoke a bash script with perl

Hi all, I use the perl script to invoke the bash script. and now there is a problem. my bash script lists as follows: and I use perl run this test scripts now the problem is when I run the perl script I find there is nothing recorded in the file /tmp/jdk.txt (2 Replies)
Discussion started by: Damon_Qu
2 Replies

5. Shell Programming and Scripting

Not able to invoke a sh script from KSH

Hi all, Iam writing a KSH script which needs to export dispaly to Xwindows and then involke a sh script .. But a core file is getting genrated for reasons not known to me. Please check i need incorporate below mentioend code in my script which iam not abel to .. export DISPLAY=`who am i |... (1 Reply)
Discussion started by: rahman_riyaz
1 Replies

6. Shell Programming and Scripting

need to invoke a script upon arrival of a file

hi all, i recieve a file from other server, on a daily basis .... but the time of arrival is unpredictable .... i need to move this file to another directory before the next file arrives ... i have written a script that does this op and performs some manipulations on the data... but i... (2 Replies)
Discussion started by: sais
2 Replies

7. Shell Programming and Scripting

Invoke shell script in cgi script

Hi, I just tried to call a simple shell script from a cgi script writing in c programming.But,it is not working.i will be grateful if anyone can show me the problems going on as i m new to c and oso shell script.Thanks. -Here is my shell script of call the 'pc shut down' system command in... (1 Reply)
Discussion started by: carolline
1 Replies

8. Shell Programming and Scripting

invoke same script twice

hey, can I invoke the same script twice simultaneously? I want both instances to run at the same time with different parameters. Thanks! (2 Replies)
Discussion started by: mpang_
2 Replies

9. Shell Programming and Scripting

Invoke java program in script

Hey all, My boss tasked me with the job to write a script which would invoke various java programs, the thing is I don't know much about shell scripting so would you experts help me out? Here is the requirement - 2 applications written in java: App_A and App_B -... (0 Replies)
Discussion started by: mpang_
0 Replies

10. Shell Programming and Scripting

how to invoke shell script

hi everybody, i learning unix now only.Can u pls guide me in invoking a shell script.Actually i need to know how to write the command for invoking the shell script.Suppose the shell file name is count , then how i will write the command. thanks (1 Reply)
Discussion started by: gopa_mani
1 Replies
Login or Register to Ask a Question