Re: [SLUG] Shell script calling shell script

From: Chuck Hast (wchast@gmail.com)
Date: Fri Nov 19 2004 - 07:30:51 EST


On Thu, 18 Nov 2004 19:59:02 -0500 (EST), Eben King
<eben1@tampabay.rr.com> wrote:
> On Thu, 18 Nov 2004, Chuck Hast wrote:
>
>
>
> > I have a set of applications that I want to configure and start up. I am
> > seeing that the general way it is done is to write the monolithic shell
> > script that sets up ports, starts apps, etc. What I really want to do is
> > have a master script that calls modular scripts that will then set up
> > a port or start a app, then if I need to go in and change something I
> > do not need to poke around the master script only go in and work on
> > the port script that I want to change.
> >
> > My question is if my main script calls another one, when that one
> > finishes, will it hand the execution back to the script that called it?
>
> Sure. The caller doesn't much care whether the callee is a builtin,
> function, an alias, a script, a compiled binary, or whatever; execution
> resumes after it exits. You can make it exit immediately by calling it as
> "whatever &" instead of "whatever".
>
> > That way say I have a machine that has 8 ports on it, each port has
> > about 10 lines of configuration, if I want to remove a port I just go in
> > and comment out the line that calls that port, I do not have to go in
> > and comment out 8-10 lines of commands and parameters.
>
> You don't have to comment out anything except the actual execution, no,
> but to prevent confusion in the future about "I wonder why that is
> commented out; none of the other stuff relating to it is", I would.
>
> > If I want to add a port I just take a template and change the parameters
> > are are port dependient and make a entry in the main script that calls
> > it.
>
> Probably. Hard to say without seeing it.
>

This is exactly what I needed to know. As long as the called script returns
control to the calling script as soon as it is done, things are VERY GOOD.
Thanks Eban.

-- 
Chuck Hast 
To paraphrase my flight instructor;
"the only dumb question is the one you DID NOT ask resulting in my going
out and having to identify your bits and pieces in the midst of torn
and twisted metal."
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:41:15 EDT