Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2003
    Posts
    2

    Unanswered: 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?

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    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

    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?

  3. #3
    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

    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

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    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

    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

  5. #5
    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 08:00.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •