Script to read input and output files and child scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to read input and output files and child scripts
# 1  
Old 10-24-2010
Script to read input and output files and child scripts

I have a directory where i have *.sas; *.pl;*.sh and *.c scripts

I need to find out what are the child scripts and input output files for each script:
say I have a shell script which calls a perl script and a sas script:
In my first line I want
I a) the parent script name;
b) the input files for this script;
c) the output files for this script
II a) the child script name:
b) input files for the child script
c) output files for the child script
d) If the child script has another child script; then the name of its child script; its input and output files

I have thousands of scripts and thought it be better if i use a master script to achieve this.

Thank you for your time,
Ram
# 2  
Old 10-24-2010
You won't get a script or program that will do this for you. The logic and flow of a script is such that another script cannot really be expected to determine what files it reads or other scripts it calls.

For example a menu script may read some configuration data files to determine what menu items to display for a paticular user or group and what programs to then call. In the code it's likley to have a function something like this:
Code:
run_option()
{
    if [ "${option}" -ge 1 -a "${option}" -le "${Max_Options}" ]
    then
       command=`awk -F"|" -v row=${option} ' { if (NR == row) print $3 } ' $TEMPFILE 2>/dev/null`
    fi
    if [ "${command}" != "" ]
    then
      clear
      eval ${command}
    fi
    option=""
    command=""

A program cannot determine what something like the above is going to execute, it would have to process the rest of the script and determine what was written into TEMPFILE before this function was called!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read input write multply output with creteria

Hi All Please Help Read input write multply output with creteria Exemple i have file abc 111 444 abc 111 444 def 111 444 def111 444 bbb 111 444 bbb 111 444 i would need write 3 files pos 1-3 is the Criteria output would be file1 contains abc file2 def file3 bbb ... (3 Replies)
Discussion started by: tonyk334
3 Replies

2. Shell Programming and Scripting

ksh - Read input from file and output CSV i same row

Hello I have the following output and want the output to look: FROM: GigabitEthernet0/0 is up, line protocol is up 1 input errors, 0 CRC, 0 frame, 1 overrun, 0 ignored 275 output errors, 0 collisions, 3 interface resets GigabitEthernet0/1 is up, line protocol is up 0... (4 Replies)
Discussion started by: JayJay2018
4 Replies

3. Shell Programming and Scripting

Read input files and merge them in given order and write them to input one param or one file

Dear Friends, I am looking for a shell script to merge input files into one file .. here is my idea: 1st paramter would be outfile file (all input files content) read all input files and merge them to input param 1 ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies

4. Shell Programming and Scripting

Using scripts to create output files

been messing around with linux for a few months...not too good yet. thinking about taking a class or something, this #### is hard.......anyway, im trying to make an output file using the input from a prompt. heres basically what i have now (random example) echo -n "Please enter your name: " read... (7 Replies)
Discussion started by: rickbobb4444
7 Replies

5. Shell Programming and Scripting

Print output and read input on same line

How do I print output and read input on the same line in ksh? echo Hello, what is your name? read name (1 Reply)
Discussion started by: robin_simple
1 Replies

6. Shell Programming and Scripting

Read input and output redirection filename within a script

Hello everyone, My requirement is that within a script I need to construct the command line exactly that it was invoked with. For example : sh a.sh arg1 arg2 arg3 < input.txt > output.txt Now within a.sh, I construct a file which has these contents " sh a.sh arg1 arg2 arg3 < input.txt >... (8 Replies)
Discussion started by: hedonist12
8 Replies

7. Shell Programming and Scripting

awk read input files

hi, i'm a beginner in writing awk scripts and I have a problem with reading input files. Requirement for my programm: compare file1 to file2 and check if value in column1 is equal and value in column5 is different. File 1: 180 P 01.01.2008 30.06.2008 2 180 P 01.07.2008 ... (10 Replies)
Discussion started by: tgooper
10 Replies

8. Programming

read input-process-output

Can you help me ? I want to write a program ,which can open a input file (input.txt) and run as child process ,then write to output file (output.txt)....... char inFile="input.txt"; char outFile="output.txt"; int main(int argc, char **argv) { pid_t pid=1; int no=0; // no. of... (5 Replies)
Discussion started by: cupid1575
5 Replies

9. UNIX for Dummies Questions & Answers

to read variable from child script

Hi I have two shell scripts A and B A calls B I would like to use a variable in A the value of which is assigned by B after calling B Thanks in advance Suresh (8 Replies)
Discussion started by: ssuresh1999
8 Replies

10. Shell Programming and Scripting

read input from 2 files and print them in alternate columns

Hi Frnz Please help me out. I have two text files. A.txt one two three four B.txt Jan Feb Mar Apr I need the output as (1 Reply)
Discussion started by: sriram.s
1 Replies
Login or Register to Ask a Question