Operating System - HP-UX
1850451 Members
3883 Online
104054 Solutions
New Discussion

which scripts are called by a particular script

 
Guido Peerboom
Occasional Contributor

which scripts are called by a particular script

Hi,

How to find out which scripts are called by a particular script ???
Scripts are 2 big 2 examine by hand.


Thanks,

Guido
It all depends on physics
2 REPLIES 2
Klaus Crusius
Trusted Contributor

Re: which scripts are called by a particular script


Ther is no way to find that out without running the script in a way.
You could do the following:
Copy the script into an empty directory.
verify that PATH is not set in the script.
set PATH=.:/usr/bin:/... (not including the directories where the reall scripts are expected).
run the script (ksh scriptname). ksh will complain about he first command it does not find and exit.
You can provide a dummy version of the missing command in your working directory, or create a soft link to the real command, and the repeat the procedure to find the second missing command. ETC.

There is a tool tusc or truss, which allows you to track all system calls (you are interested in exec).

Regards, Klaus

There is a live before death!
Thom Cornwell
Frequent Advisor

Re: which scripts are called by a particular script

I would suggest that you place at the beginning of the script a set -x. This shows what is executing as it executes. You can probably key off the external programs being called by the path to them being shown.
#!/bin/ksh
set -x