On Tue, Dec 11, 2018 at 2:42 PM Devin Teske <dte...@freebsd.org> wrote:
> In that case, would it be appropriate to say that:
>
>         blah | while read x; do ...; done
>
> Is always more efficiently written as:
>
>         IFS=$'\n'
>         for x in $( blah ); do ...; done

I don't know.  The suggestion came from jilles@, who is much more
familiar with sh(1) than I am.

My understanding is that it's important that 'set -o noglob' is set,
or else 'blah' lines that include globs may be evaluated against the
filesystem.  There is also a caveat if 'blah' is the 'set' command, or
similar, in that IFS' own value itself will be split across multiple
for loop iteration 'x' values ("IFS='", "'").

I would hesitate to say "always" given my limited understanding of the
shell, but it might be true.

Best,
Conrad
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to