Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 04 Apr 2013 16:25:52 +0300
From:      Nikos Vassiliadis <nvass@gmx.com>
To:        Mark Felder <feld@feld.me>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: OT: posix sh problem
Message-ID:  <515D7F60.7000109@gmx.com>
In-Reply-To: <op.wu0nsgsf34t2sn@tech304.office.supranet.net>
References:  <op.wu0nsgsf34t2sn@tech304.office.supranet.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 4/4/2013 3:32 μμ, Mark Felder wrote:
> 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.

I am not sure about posix compliance but I haven't seen a bourne-like
shell not supporting the "prog | while read a b c ..." syntax.
FreeBSD's /bin/sh supports this.

Did you mean something else, did I
misunderstand your question?

Nikos




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?515D7F60.7000109>