RE: shell scripting: help appreciated

2006-07-04 Thread [EMAIL PROTECTED]@mgedv.net
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Parv
> Sent: Monday, July 03, 2006 7:50 PM
> To: [EMAIL PROTECTED]@mgedv.net
> Cc: freebsd-questions@freebsd.org
> Subject: Re: shell scripting: help appreciated
> 
> in message <[EMAIL PROTECTED]>,
> wrote [EMAIL PROTECTED]@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 testval1optional_testval1
> > test2 testval2optional_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
> >   
> >   /bin/sh -c subprogram.sh $h_val1 $h_val2 $h_opt1;
> >   
> > done;
> > 
> > /test/foo_sub.sh:
> > 
> > ---
> > 
> > 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?
> 

it's not depending on the record. the layout of each record is 2
fixed an one variable field of data which is then put together to
directory/file-names inside the subprogram.
the subprogram just simply should loop for each record inside the
controlfile, which is done correctly if i change the subprogram to
an just "say hello" script.
if i run the really program, the loop stops (not immediately after
calling the subprogram, it just normal finishes the loop) after
working on lesser records as there are inside the .conf file.

no idea of what's going on.

btw., for each record - after the subprogram has successfully worked
on it a "done" flag is set and the subprogram is not called again
for this record.
looping the main program again and again renders the subprogram to
get executed for the other records as well.
it looks like, if there is heavy execution inside the subprogram,
the main program "forgets" about some data inside the loop.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


RE: shell scripting: help appreciated

2006-07-04 Thread [EMAIL PROTECTED]@mgedv.net
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Atom Powers
> Sent: Monday, July 03, 2006 5:40 PM
> Cc: freebsd-questions@freebsd.org
> Subject: Re: shell scripting: help appreciated
> 
> On 7/3/06, [EMAIL PROTECTED]@mgedv.net <[EMAIL PROTECTED]> wrote:
> 
> >
> > 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!
> 
> 
> try:
> 
> eval /bin/sh -c "subprogram.sh $h_val1 $h_val2 $h_opt1";
> 
> 

well, even changing to "/bin/sh -c subprogram.sh" without passing
any parameters (everything is taken now from the environment, the
program still stops after reading lesser records from the input
file as there are :-(
the shell returnvalue is being checked after the subprogram returns
and i get all the messages after the subprogram inside the loop, too.
so it's not an error-exit or something like that. it's just as if there
were lesser records for the input to the loop.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: shell scripting: help appreciated

2006-07-03 Thread Parv
in message <[EMAIL PROTECTED]>,
wrote Parv thusly...
>
> in message <[EMAIL PROTECTED]>,
> wrote [EMAIL PROTECTED]@mgedv.net thusly...
> >

By the way [EMAIL PROTECTED]@mgedv.net do something about ... 

  Reporting-MTA: dns; mta9.adelphia.net
  Arrival-Date: Mon, 3 Jul 2006 13:49:48 -0400
  Received-From-MTA: dns; default.chvlva.adelphia.net (69.160.66.115)

  Final-Recipient: RFC822; <[EMAIL PROTECTED]>
  Action: failed
  Status: 5.2.0
  Remote-MTA: dns; mail.mgedv.net (81.223.168.230)
  Diagnostic-Code: smtp; 521 : Client host 
rejected: 550 service denied (20003)



  - Parv

-- 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: shell scripting: help appreciated

2006-07-03 Thread Parv
in message <[EMAIL PROTECTED]>,
wrote [EMAIL PROTECTED]@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 testval1optional_testval1
> test2 testval2optional_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
>   
>   /bin/sh -c subprogram.sh $h_val1 $h_val2 $h_opt1;
>   
> done;
> 
> /test/foo_sub.sh:
> 
> ---
> 
> 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

-- 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: shell scripting: help appreciated

2006-07-03 Thread Atom Powers

On 7/3/06, [EMAIL PROTECTED]@mgedv.net <[EMAIL PROTECTED]> wrote:



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!



try:

eval /bin/sh -c "subprogram.sh $h_val1 $h_val2 $h_opt1";


--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"