Re: [SLUG] Shell script calling shell script

From: Eben King (eben1@tampabay.rr.com)
Date: Thu Nov 18 2004 - 19:59:02 EST


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.

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar

An idea that is not dangerous is unworthy of being called an idea at all. -Oscar Wilde

----------------------------------------------------------------------- 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:39:41 EDT