ZFS no longer mounted in alphanumerical order
Jan Martin Mikkelsen
janm at transactionware.com
Tue Mar 12 12:52:53 UTC 2019
> On 12 Mar 2019, at 12:14, Trond Endrestøl <Trond.Endrestol at fagskolen.gjovik.no> wrote:
>> An alternative sort approach, which handles df arguments which change the number of columns, and only invokes df once:
>>
>> ${DF} "$@" | awk '/^Filesystem/ { print; sort = "sort -k " NF } ! /^Filesystem/ { print | sort }’
>
> Well, yes and no, mostly no.
>
> Why are we feeding each line from df(1) separately to sort(1)?
> It defeats the entire purpose. No sorting takes place.
>
> We might be better off accumulating the majority of the lines and
> sorting them in an END block.
That’s not how awk works. It maintains a pipe and feeds each line to the same sort process.
There is another bug there, of course. The field number should be (NF - 1) because of the space in the “Mounted on” header on the last column. That’s what I get for just typing code into an email.
Regards,
Jan M.
More information about the freebsd-current
mailing list