I wrote a shell script , which includes one output file which is emailed back to me , when the script runs .
Now i want to slip the script into 4 different shell scripts each of which taking the parameter PROD or DEV, and include all the 4 different shell scripts in a caller script.
The idea behind doing like this is , if their is problem with one script atleast the other script should not stop from running .
Now my whole idea is still to get only one email when we run the caller script .
So how to direct the output of each script such a way , that we get only one output file and one email from running the caller.
Pls help me , with this .
Also , can the common local variables to all the 4 shell scripts be in the caller script and code where it chooses the parm PROD or DEV ..
is so , how would the 4 scripts take those local variables and use them to run itself .
In sh and bash there's no way to pass parameters from child to parent, neither from subshells to master shell.
The turnaround i use is to write parameters in an appropriate form to a file. The form can be just values of the variables or strings like "var_A=value" which can be treated after reading by 'eval'.
If you don't write to disk, maybe you have a /dev/shm directory which is a world-writeable "ramdisk" which can be useful to store temporary files or parameters.
The problem you can encounter is when two ore more scripts try to write simultaneously to the file, if there's only one.
The ". " doesn't make a call of the script but sources the script. ". script.sh" is an equivalent of "source script.sh". It doesn't launch any new process, it's like an "include" in C.