Re: [SLUG] Shell script calling shell script

From: Eben King (eben1@tampabay.rr.com)
Date: Fri Nov 19 2004 - 15:15:02 EST


On Fri, 19 Nov 2004, Chuck Hast wrote:

> On Fri, 19 Nov 2004 11:30:25 -0500 (EST), Vijay V. Swami
> <vswami@cise.ufl.edu> wrote:
> > > 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.
> >
> > Only time it wouldn't is if you exec*(3) the new script from the
> > caller. In that case the entire image of the caller gets replaced
> > with the callee.
> >
> > example:
> >
> > # ls
> >
> > versus
> >
> > # exec ls
> >
> > man 3 exec for more details.
> >
> I will check the present scrips and make sure that none of them are doing
> so, I would think that if there was such a command already in a script that
> command would stop any processing of the script from that point on.
>
> All I am going to do is take a GREAT BIG one and break it down into modules
> so it is more manageable.

If it's

configuration and comments
configuration and comments
configuration and comments
<something>

configuration and comments
configuration and comments
configuration and comments
<something>

configuration and comments
configuration and comments
configuration and comments
<something>

then the <somethings>s cannot be exec anything, because exec transfers
control, and the master script would no longer be running as soon as it
"exec"ed something.

If the sections are related, then what you might want to do is something
like

for subsystem in foo bar baz quux ; do
  $subsystem &
  usleep 100000 # optional
done

Nice and short, and you're assured that you call the subsystems in the
same way. Easy to add/delete subsystems, too.

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
GEMINI:  Your birthday party will be ruined once again by your explosive
flatulence. Your love life will run into trouble when your fiancee hurls a
javelin through your chest.  -- Weird Al, _Your Horoscope for Today_

----------------------------------------------------------------------- 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:44:27 EDT