RUNNING A GROUP OF SCRIPTS FROM A SINGLE SUPERVISORY SCRIPT

RUNNING A GROUP OF SCRIPTS FROM A SINGLE SUPERVISORY SCRIPT

Post by pro.. » Fri, 15 Dec 2000 16:10:51



I have a script that runs in a directory. It is invoked from inside
the directory. It acts on the subject files in that directory assuming
that all pathnames of the subject files are with respect to the inside
of the directory. Thus far no problem.

Now I have a cluster of such directories, each with the same script
in it and its own distinct subject files.

I want to run all these scripts one after the other from outside these
directories from a single supervisory script.

The problem is that the child scripts that are in their subdirectories
inherit the environment variables including $PWD or $CWD,(???) from the
supervisory script. Then the names are with reference to the supervisory
script which is run from its location, a natural choice.

How to solve this problem? I would like to see various approaches as
a useful set of tricks for the future, but my present need is to make
as little modification to the child scripts as possible. You can assume
that the child scripts are as simple as follows:

------------------------------
:
cat file1 file2 > file3;

------------------------------

The names of the subdirectories change all the time and the script
should not be dependent on the name of the directory it is in, or
the location of the supervisory script. Essentially if the script
can run as if it was executed by changing to its directory.

Thanks to the star who can help!!!

Sent via Deja.com
http://www.deja.com/

 
 
 

RUNNING A GROUP OF SCRIPTS FROM A SINGLE SUPERVISORY SCRIPT

Post by Barry Margoli » Sun, 17 Dec 2000 08:33:49



>The names of the subdirectories change all the time and the script
>should not be dependent on the name of the directory it is in, or
>the location of the supervisory script. Essentially if the script
>can run as if it was executed by changing to its directory.

Something like this:

for subdir in *
do
  cd subdir
  scriptname
  cd ..
done

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

1. -> RUNNING A GROUP OF SCRIPTS FROM A SINGLE SUPERVISORY SCRIPT

I have a script that runs in a directory. It is invoked from inside
the directory. It acts on the subject files in that directory assuming
that all pathnames of the subject files are with respect to the inside
of the directory. Thus far no problem.

Now I have a cluster of such directories, each with the same script
in it and its own distinct subject files.

I want to run all these scripts one after the other from outside these
directories from a single supervisory script.

The problem is that the child scripts that are in their subdirectories
inherit the environment variables including $PWD or $CWD,(???) from the
supervisory script. Then the names are with reference to the supervisory
script which is run from its location, a natural choice.

How to solve this problem? I would like to see various approaches as
a useful set of tricks for the future, but my present need is to make
as little modification to the child scripts as possible. You can assume
that the child scripts are as simple as follows:

------------------------------
:
cat file1 file2 > file3;

------------------------------

The names of the subdirectories change all the time and the script
should not be dependent on the name of the directory it is in, or
the location of the supervisory script. Essentially if the script
can run as if it was executed by changing to its directory.

Thanks to the star who can help!!!

Sent via Deja.com
http://www.deja.com/

2. Darwin Streaming Server for PPC?

3. Incomplete output from crontab email: running shell scripts from a perl script

4. Help Replacing libraries

5. Running scripts using variables in a parent script

6. msoutlook attachments

7. script that run a sql script

8. Terminal Server

9. scripts running other scripts

10. running a program from within a script then returning to the script

11. FreeBSD 4.0 : where are the run level specific start up scripts/links to scripts?

12. Shell script to run script to record output from a program

13. Running scripts without >csh script!