script invoking shel script.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script invoking shel script.
# 1  
Old 04-14-2008
Bug script invoking shel script.

Hi,

I have a shell script which will start a process in my prodution server.

I want to write one more script as a cron job, which will start the first script at regular intervals.

My question is what are the things I have to make sure to invoke the first script in second script.

Can I directly write the script name as a command in the second script, will that be sufficient to run it.
# 2  
Old 04-14-2008
you should be heading here
# 3  
Old 04-14-2008
You may invoke the other script using "source" comand:

source name_second_script
# 4  
Old 04-14-2008
Actually unless you specifically want the script you call to be invoked as part of the calling script, you just name it, like you guessed. It will then be invoked as a separate process (whereas if you use "source" it will be sort of inlined in the current script).

There is a time and a place for "source" and that is mainly if the sourced script needs to set variables etc. which persist in the script which invoked it.

(It's not called "source" in proper Bourne shell; the command is just . (dot).)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to simulate ''Esc'' keystroke in a bash shel script?

I am using Ubuntu 12.4 I am running the following script: ++++++++ #!/bin/bash while ; do xdotool mousemove 248 539 click 1 & sleep 3 done +++++++++ This moves the mouse on the specified position on the screen and clicks that pauses the script for 3 seconds and repeats the... (2 Replies)
Discussion started by: alfarnume
2 Replies

2. UNIX for Dummies Questions & Answers

invoking script

hi all, is there a way to run a script upon invoking an application . for eg if i click on mozilla i want a script to run , before runniing mozilla , maybe ask a password or something only then open mozilla (2 Replies)
Discussion started by: mithun1!
2 Replies

3. Shell Programming and Scripting

Invoking a script

I am new to Unix. Could some tell me what are all the possible ways of invoking/executing a script, doesnt matter which shell you are in. Thanks (4 Replies)
Discussion started by: bobby1015
4 Replies

4. Homework & Coursework Questions

need help with a shel script plzz

hey how u doing guys ... I'm a student @ EMU and taking a beginner Linux class and I have those two extra credit project that im struggling with so I hope to get some correction and help write a shell script that will 1-prompt the user for a file name 2-check to see if the file exists... (2 Replies)
Discussion started by: flyman
2 Replies

5. Shell Programming and Scripting

Help with invoking sed from a script

Hello I have a .sh script that needs to take a template and replace zzz in the template file with the user's name. I cannot figure out how to make the following work from my script (works from the command prompt) but not when I put it inside a *.sh script sed 's/xxx/$USER/g' template.conf >... (2 Replies)
Discussion started by: kasiolas
2 Replies

6. Shell Programming and Scripting

need some clarification on for loop in shel script

for ( ( $i=0 ; $i<=6 ; $i++ ) ) do p=/RSA-Data/PE-data00"${i}" echo "$p" done --- i need output as below /RSA-Data/PE-data000 . . . /RSA-Data/PE-Data006 (1 Reply)
Discussion started by: mail2sant
1 Replies

7. Shell Programming and Scripting

pass the input to invoking script

How to pass the input to the execution script ex: test1.sh contains #! usr/bin/sh read val echo $val test2.sh contains #! /usr/bin/sh ./test1.sh now I am calling test2.sh thro command line and I want to pass the input to the script test1.sh from test2.sh ..I mean not... (6 Replies)
Discussion started by: vastare
6 Replies

8. Shell Programming and Scripting

returning to the parent shell after invoking a script within a script

Hi everybody, I have a script in which I'm invoking another script which runs in a subshell. after the script is executed I want to return to the parent shell as some variables are set. However i'm unable to return to my original shell as the script which i'm calling inside is invoked in... (5 Replies)
Discussion started by: gurukottur
5 Replies

9. Shell Programming and Scripting

invoking one shell script from other

hi, i am one day old in shell scritpting. how to invoke one shell script from the other? For eg.i have two shell scripts A.sh and B.sh. Inside A.sh i need to invoke B.sh and the return code of A.sh should be the value returned by B.sh. it would be better if you provide any sample shell... (3 Replies)
Discussion started by: ajay xavier
3 Replies

10. Shell Programming and Scripting

Shel Script doesn't work from Exceed

Hi, I am using this script to load up my Oracle Databases, but when I log in through Exceed, it hangs. Can anyone tell me what else I need to add to make this work?? Details ****************************************************************************************************... (11 Replies)
Discussion started by: dnkansah
11 Replies
Login or Register to Ask a Question