shell scripting: help appreciated
Parv
parv at pair.com
Mon Jul 3 17:49:51 UTC 2006
in message <006701c69e7a$7898db00$01010101 at avalon.lan>,
wrote no at 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
--
More information about the freebsd-questions
mailing list