On 21/05/13 09:09, Phillip Smith wrote:
On 20 May 2013 20:58, Dave Reisner <d@falconindy.com> wrote:
Not what I had in mind (or gave you). This will "work", but the process substitution is preferable over the here string.
Sorry; what I saw in yours was '<<' which obviously didn't work so I assumed you meant '<<<'
On 20 May 2013 21:07, Allan McRae <allan@archlinux.org> wrote:
Also not you do not need the whole for loop here. Just
printf " %s\n" "${srcdir_refs[@]}"
That did not work in my testing; line breaks were not preserved.
allan@arya ~
mapfile -t srcdir_refs < <(cd "tmp" && find -type f -exec grep -Il "10" {} +)
allan@arya ~
echo ${srcdir_refs[@]} ./out/out-7.txt ./out/out-3.txt ./out/out-2.txt ./out/out-9.txt ./out/out-8.txt ./out/out-5.txt ./out/out-4.txt ./out/out-1.txt ./out/out-6.txt
allan@arya ~
printf " %s\n" ${srcdir_refs[@]} ./out/out-7.txt ./out/out-3.txt ./out/out-2.txt ./out/out-9.txt ./out/out-8.txt ./out/out-5.txt ./out/out-4.txt ./out/out-1.txt ./out/out-6.txt