From owner-freebsd-questions@FreeBSD.ORG Mon Jul 3 17:49:51 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4458C16A4AB for ; Mon, 3 Jul 2006 17:49:51 +0000 (UTC) (envelope-from parv@pair.com) Received: from mta9.adelphia.net (mta9.adelphia.net [68.168.78.199]) by mx1.FreeBSD.org (Postfix) with ESMTP id 496ED43D7B for ; Mon, 3 Jul 2006 17:49:48 +0000 (GMT) (envelope-from parv@pair.com) Received: from default.chvlva.adelphia.net ([69.160.66.115]) by mta9.adelphia.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060703174948.BPET28449.mta9.adelphia.net@default.chvlva.adelphia.net>; Mon, 3 Jul 2006 13:49:48 -0400 Received: by default.chvlva.adelphia.net (Postfix, from userid 1000) id 513C4B537; Mon, 3 Jul 2006 13:49:49 -0400 (EDT) Date: Mon, 3 Jul 2006 13:49:49 -0400 From: Parv To: "no@spam@mgedv.net" Message-ID: <20060703174949.GA16998@holestein.holy.cow> Mail-Followup-To: "no@spam@mgedv.net" , freebsd-questions@freebsd.org References: <006701c69e7a$7898db00$01010101@avalon.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <006701c69e7a$7898db00$01010101@avalon.lan> Cc: freebsd-questions@freebsd.org Subject: Re: shell scripting: help appreciated X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: f-q List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2006 17:49:51 -0000 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 > > /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 --