From owner-freebsd-questions@FreeBSD.ORG Thu Apr 4 15:11:39 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 91CD48BF; Thu, 4 Apr 2013 15:11:39 +0000 (UTC) (envelope-from feld@feld.me) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by mx1.freebsd.org (Postfix) with ESMTP id 4F32290F; Thu, 4 Apr 2013 15:11:38 +0000 (UTC) Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id BC3C119EE; Thu, 4 Apr 2013 11:11:37 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute2.internal (MEProxy); Thu, 04 Apr 2013 11:11:37 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=feld.me; h= content-type:to:subject:references:date:cc:mime-version :content-transfer-encoding:from:message-id:in-reply-to; s= mesmtp; bh=N0gpQw2JCYgHA7ZDBvodmUGxGBA=; b=B5X2Q2ju2dN0Aa+YePFX5 IRJ3Pk6x45MTPFXT0R8hkiyGL+2oBANDjFMlDKfDYdJWbRpXecc6l6BZmUg1rXoN vm6GLWy1Nc6phGNHLcUJP1Tq3FYQupbUPBf5WhP7ZZqTQ62rwbF/IU05HNUAfG7D /wznV1pLAu34I2em5BeRoQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:to:subject:references:date :cc:mime-version:content-transfer-encoding:from:message-id :in-reply-to; s=smtpout; bh=N0gpQw2JCYgHA7ZDBvodmUGxGBA=; b=DuX6 WHl3lvSFKi9Y6Syjt5PDIgc7XHxQZE8oZdjalA/TDh+R/1ujJ86ESoudBq/ODtvF ASHQdr1jNoozlUHDP1pzlfLtPosFJZxRWhkVqIrzxYulTIy+0UCqjlaFl9JKLW7d Qxi8XZVX9DHxdOD8trINAG6dKewkuGAaGy6PoPA= X-Sasl-enc: aP7ALc4/WXeVCUmHWCz9ifI/iH3z76Y6daBFhSsjiCBR 1365088295 Received: from tech304.office.supranet.net (unknown [66.170.8.18]) by mail.messagingengine.com (Postfix) with ESMTPA id C8562200048; Thu, 4 Apr 2013 11:11:35 -0400 (EDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Teske, Devin" , "Devin Teske" Subject: Re: OT: posix sh problem References: <13CA24D6AB415D428143D44749F57D7201EF2411@ltcfiswmsgmb21> Date: Thu, 04 Apr 2013 10:11:35 -0500 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable From: "Mark Felder" Message-ID: In-Reply-To: <13CA24D6AB415D428143D44749F57D7201EF2411@ltcfiswmsgmb21> User-Agent: Opera Mail/12.14 (FreeBSD) Cc: "" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Apr 2013 15:11:39 -0000 Sorry, my email client did something weird with collapsing and I didn't = = see you mention that it appeared to be working for you. On Thu, 04 Apr 2013 08:54:30 -0500, Teske, Devin = wrote: > The only things I saw that needed changing to go from ksh to /bin/sh = > were: > if [ =E2=80=A6 =3D=3D =E2=80=A6 ]; then > Needs to be > if [ =E2=80=A6 =3D =E2=80=A6 ]; then > And optionally, a style nit would be to convert back-tick pairs into = > nestable $(=E2=80=A6) syntax. For example, change: > cap=3D`=E2=80=A6` > to instead: > cap=3D$(=E2=80=A6) > Oh and of course, the HTML should go away since you're making a = > command-line tool and not a BB/Hobbit/Xymon module. I actually will be using this with Xymon at work. I did fix the =3D=3D a= nd = style nit when I went over this script I'm still having a problem. When = I = started debugging this last night $STRING led me to believe the pipe int= o = read wasn't working right. At the bottom of the script I added echo in = front of the "$BB $BBDISP...." line. My output is this: # sh zfs_xymon.sh status .zfs green Thu Apr 4 09:59:36 CDT 2013 zfs - health: okay - = capacity: okay
Zpool= = NameStatusCapacity


all pools= = are healthy Where are the other parts of the table showing each zpool? Those are jus= t = the headers. If you sh -x you'll see it flow like this: + read name size used avail cap depup health altroot + STRING=3D'
Zpool = NameStatusCapacity


' + /sbin/zpool status -xv It's like everything between do ... done never happened? If you put echo= = in front of line 60 you DO get output: # sh zfs_xymon.sh STRING=3D = status .zfs green Thu Apr 4 10:07:30 CDT 2013 zfs - health: okay - = capacity: okay
Zpool = NameStatusCapacity
&greentankONLINE48
Zpool= = NameStatusCapacity


all pools= = are healthy But as you can see, everything in that do ... done is disappearing. = According to Rich's Posix sh tricks site it explains that the things to = = the right of that pipe are completed in a subprocess. The updates it mak= es = to STRING never make it out so it can be used in the rest of the script.= Do you see what I mean now? :(