Sujet : Re: Iterating over a set in bash (Was: Problem with 'rm -i' in ksh)
De : Lem (at) *nospam* none.invalid (Lem Novantotto)
Groupes : comp.unix.shellDate : 13. Jan 2025, 21:39:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vm3tmq$20qtd$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Pan/0.160 (Toresk; )
Il Mon, 13 Jan 2025 02:54:02 -0000 (UTC), Kenny McCormack ha scritto:
So, instead of:
... | while read ...
I will do:
mapfile -t < <(...)
for i in "${MAPFILE[@]}"; do
...
done
Your solution has its advantages, but IMHO it has many drawbacks too.
It's more memory consuming, less portable, it doesn't react promptly...
And you cannot follow and process in real time a streams, of course.
You cannot do something like:
$ while true; do echo yes; done |while read $w; do echo "$w and no"; done
-- Bye, Lem Talis erit dies qualem egeris