On 2020-08-01, TomK <tomk...@mdevsys.com> wrote: > Thanks very much Karl. Appreciate this feedback. You've answered alot > of the lingering questions I had around this topic. Much appreciated! > > Just for some continued open discussion, included some basic answers. > Not meant to sway to one side or the other, just to understand reasoning > behind what I see used. > > On 7/30/2020 5:05 PM, Karl Berry wrote: [...] >> I don't agree with "deprecated". Left quotes must continue to work >> forever and there is every reason to use them, in shell code that must >> be maximally portable. > > access.redhat.com/solutions/715363 > > for i in `find /usr/include -type f ` > > fails on very large results. $() has a higher results limit.
This is the least of your problems with this construct. It will also perform word splitting and pattern expansion on the filenames, which is almost certainly not intended or desired so if you need to do something like this in a configure script it is probably better to find a portable construct which does not have these problems (I suspect such a solution will not use command substitution at all). Even if $() was portable it does not improve things very much; consider the following: % mkdir /tmp/cwd % echo hello >/tmp/cwd/totally_unrelated_file % cd /tmp/cwd % mkdir /tmp/test % mkdir /tmp/test/not_even_a_file % echo hello >'/tmp/test/* *' % for i in $(find /tmp/test -type f); do printf '%s\n' "$i"; done /tmp/test/* * /tmp/test/not_even_a_file totally_unrelated_file Oops...