Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jul 2006 13:49:49 -0400
From:      Parv <parv@pair.com>
To:        "no@spam@mgedv.net" <nospam@mgedv.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: shell scripting: help appreciated
Message-ID:  <20060703174949.GA16998@holestein.holy.cow>
In-Reply-To: <006701c69e7a$7898db00$01010101@avalon.lan>
References:  <006701c69e7a$7898db00$01010101@avalon.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
in message <006701c69e7a$7898db00$01010101@avalon.lan>,
wrote no@spam@mgedv.net thusly...
>
> /bin/sh stops working correctly with a content-controlled do-loop.
> 
> the shell-script layout is as follows:
> (it's not that trivial, just to show the meaning)
> ---------------------------------------------------------------
> /test/foo.conf (originally ~60 lines):
> test1         testval1                optional_testval1
> test2         testval2                optional_testval2
> 
> /test/foo.sh (this is the original loop code):
> cat "$g_dir_etc/compile.lst"|\
...
( some pipeline )
...
> while read gh_name gh_src gh_srcdir
> do
>       <set some vars here>
>       /bin/sh -c subprogram.sh $h_val1 $h_val2 $h_opt1;
>       <do some stuff here>
> done;
> 
> /test/foo_sub.sh:
> <we do very much stuff in here, like compiling programs etc...>
> ---------------------------------------------------------------
> 
> if i change the line
>       /bin/sh -c subprogram.sh $h_val1 $h_val2 $h_opt1;
> to
>       echo /bin/sh -c subprogram.sh $h_val1 $h_val2 $h_opt1;
> the program loops for all records in the foo.conf correctly.
> 
> if i remove the "echo" keyword, the sub-script get's executed,
> but the shell terminates as if there were lesser records in
> the foo.conf file!
> i scripted as many debug messages as possible, for every loop
> they get executed and there are no errors/etc... happening.
> and interestingly, the execution stops always on the same record!
> if i comment out some records of my foo.conf, the sub-shell gets
> executed for more records.

So, what is it exactly in the records (and/or values given to
subprogram.sh) where the execution stops?


  - Parv

-- 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060703174949.GA16998>