PDA

View Full Version : script calling another script


qtcheung
04-02-03, 20:43
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?

sathyaram_s
04-03-03, 04:33
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

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?

qtcheung
04-03-03, 16:09
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

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

sathyaram_s
04-05-03, 20:12
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

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

sypher
06-26-03, 09:11
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