From owner-freebsd-questions@FreeBSD.ORG Thu Apr 4 12:32:33 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BF9465A4 for ; Thu, 4 Apr 2013 12:32:33 +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 952E1C1A for ; Thu, 4 Apr 2013 12:32:32 +0000 (UTC) Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 79053BC2 for ; Thu, 4 Apr 2013 08:32:31 -0400 (EDT) Received: from frontend1.nyi.mail.srv.osa ([10.202.2.160]) by compute4.internal (MEProxy); Thu, 04 Apr 2013 08:32:31 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=feld.me; h= content-type:to:subject:date:mime-version :content-transfer-encoding:from:message-id; s=mesmtp; bh=5RzPlGq SRWHBNmE3YqKSBtc0Wpo=; b=lQtxkutMieGeEWZUxtBDSsb8/7Xx9dmX3L/RKla mbLVMLdkJO0CJe8SYdOiCVugo0g6JOl0FdK97q//qEL8p9H/fYM6p2yHzsPMbhKd BRIcJV5GHwskgIMa8FnKGlOS8WyiEmPQ/R7fWvk2Goms2Q7N7kNRklQ8yQ9hw08i DHPs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:to:subject:date:mime-version :content-transfer-encoding:from:message-id; s=smtpout; bh=5RzPlG qSRWHBNmE3YqKSBtc0Wpo=; b=VN+DUpakPwFdvXtv3Lbo/PKAB2cRPa5MBnyAt4 Wp0YhsAbzZ+0S9DyPdMEbaDcfRV6lTGPpHsskzH+iRKmp5X+0IKMjLVTs4nFFVhX /pblLLSNDgkQ0iWMediAlN+W+QvWaLfuPUqzTkxmxLKWALopTxWx2WhJkkhpdcya r6BHg= X-Sasl-enc: dp30k0UMnk/aokCD9WQDWcqotgXnMv+bFz2yBnxgpfZD 1365078751 Received: from tech304.office.supranet.net (unknown [66.170.8.18]) by mail.messagingengine.com (Postfix) with ESMTPA id 0E5BFC80008 for ; Thu, 4 Apr 2013 08:32:31 -0400 (EDT) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: freebsd-questions@freebsd.org Subject: OT: posix sh problem Date: Thu, 04 Apr 2013 07:32:30 -0500 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Mark Felder" Message-ID: User-Agent: Opera Mail/12.14 (FreeBSD) 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 12:32:33 -0000 Hi all, Hopefully someone here is much more clever than I am. I've run out of ideas on how to cleanly convert this chunk of ksh to posix sh. This is from a BB/Hobbit/Xymon monitoring script for ZFS. I'd really like to have this working cleanly on FreeBSD without requiring any funky shells or using any temporary files. The following is supposed to be able to loop through the output of multiple zpools reading one line at a time and each line item is set as a variable: /sbin/zpool list -H | while read name size used avail cap dedup health altroot do # do interesting things here done Unfortunately you can't pipe through read in posix sh. You also can't use process substitution: while read var1 var1 < <(/sbin/zpool list -H) Any ideas are greatly appreciated. I know there's a python-based script floating on github but I cant guarantee every server will have python on it... Source of script is here: http://en.wikibooks.org/wiki/System_Monitoring_with_Xymon/Other_Docs/HOWTO#Hobbit_Client_and_ZFS_monitoring