OT: posix sh problem
Nikos Vassiliadis
nvass at gmx.com
Thu Apr 4 13:26:00 UTC 2013
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
More information about the freebsd-questions
mailing list