If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > script calling another script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-02-03, 19:43
qtcheung qtcheung is offline
Registered User
 
Join Date: Apr 2003
Posts: 2
script calling another script

if script A is dependent on script B but script A creates a new shell session but Script B needs to run on that same session, do you have any idea how do I go about calling these two scripts to run on the same session?
Reply With Quote
  #2 (permalink)  
Old 04-03-03, 03:33
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,543
Re: script calling another script

To run in the same shell, you will have to use a '.' , for eg ...

host1:/home/user1>. .profile

The first . indicates that the script .profile should run in the same shell ...

Cheers

Sathyaram

Quote:
Originally posted by qtcheung
if script A is dependent on script B but script A creates a new shell session but Script B needs to run on that same session, do you have any idea how do I go about calling these two scripts to run on the same session?
Reply With Quote
  #3 (permalink)  
Old 04-03-03, 15:09
qtcheung qtcheung is offline
Registered User
 
Join Date: Apr 2003
Posts: 2
Re: script calling another script

Thank you for the quick respond. I have tried that and it works great. The problem I'm having is that I have two scripts. One script is a shell script and the other is a perl script. The perl script is dependent on the shell script in order to run properly. I'm trying to run a cronjob to have the shell script run first without without creating a new process and have the perl script run on that same shell. Is this possible? Can cron do that?

Thanks
Tommy

Quote:
Originally posted by sathyaram_s
To run in the same shell, you will have to use a '.' , for eg ...

host1:/home/user1>. .profile

The first . indicates that the script .profile should run in the same shell ...

Cheers

Sathyaram
Reply With Quote
  #4 (permalink)  
Old 04-05-03, 19:12
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,543
Re: script calling another script

I do not think it can be done ... Because for every cron job a new shell is created and script executed ....

I do not have any idea of perl, but can't you call perl from within a shell ... I'd suggest you do that and pass on variables to it

Cheers

Sathyaram

Quote:
Originally posted by qtcheung
Thank you for the quick respond. I have tried that and it works great. The problem I'm having is that I have two scripts. One script is a shell script and the other is a perl script. The perl script is dependent on the shell script in order to run properly. I'm trying to run a cronjob to have the shell script run first without without creating a new process and have the perl script run on that same shell. Is this possible? Can cron do that?

Thanks
Tommy
Reply With Quote
  #5 (permalink)  
Old 06-26-03, 08:11
sypher sypher is offline
Registered User
 
Join Date: Jan 2003
Location: Scotland
Posts: 17
You can Call perl from a shell script and it runs on the same shell. It is also easy to pass parameters to it.

eg

perl nameofperlscript $1 $2 etc

use something like this in the shell script and it should run on the same shell

Last edited by sypher; 08-11-03 at 07:00.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On