Date: Tue, 11 Dec 2018 17:00:15 -0800 From: Conrad Meyer <cem@freebsd.org> To: Devin Teske <dteske@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341803 - head/libexec/rc Message-ID: <CAG6CVpXkQ0fZCj=-nhmJzbju5suMxY=giRoSdg6LXeWO-i3E8A@mail.gmail.com> In-Reply-To: <917251B0-00E0-47E2-B6FB-568EDB9ED781@FreeBSD.org> References: <201812110138.wBB1cp1p006660@repo.freebsd.org> <2a76b295-b2da-3015-c201-dbe0ec63ca5a@FreeBSD.org> <98481565-CDD7-4301-B86B-072D5B984AF7@FreeBSD.org> <dafbcc18-146f-2e4f-e1e9-346d7c05b096@FreeBSD.org> <CANCZdfqtyvxCBwdwDQ4Raeven2LmaPd3C-c---pVFhHDWBKfxA@mail.gmail.com> <CAG6CVpVtWL448-pxW9EK7SEe7Cfk1mkCvPNmtE=YuFWM3Bn0tA@mail.gmail.com> <C3D7104B-2A6F-4BF0-865C-B941651EDD1A@FreeBSD.org> <CAG6CVpXVNYyQmdZcADBE_CJB1toKPdnHZEfY54Do-OcYeDAzJg@mail.gmail.com> <917251B0-00E0-47E2-B6FB-568EDB9ED781@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 11, 2018 at 2:42 PM Devin Teske <dteske@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXkQ0fZCj=-nhmJzbju5suMxY=giRoSdg6LXeWO-i3E8A>