Re: Iterating over a set in bash (Was: Problem with 'rm -i' in ksh)

Liste des GroupesRevenir à cu shell 
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.shell
Date : 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

Date Sujet#  Auteur
11 Jan 25 * Problem with 'rm -i' in ksh21Janis Papanagnou
11 Jan 25 +* Re: Problem with 'rm -i' in ksh15Lem Novantotto
11 Jan 25 i`* Re: Problem with 'rm -i' in ksh14Janis Papanagnou
12 Jan 25 i `* Re: Problem with 'rm -i' in ksh13Lem Novantotto
12 Jan 25 i  `* Re: Problem with 'rm -i' in ksh12Janis Papanagnou
12 Jan 25 i   `* Re: Problem with 'rm -i' in ksh11Kenny McCormack
12 Jan 25 i    `* Re: Problem with 'rm -i' in ksh10Janis Papanagnou
12 Jan 25 i     +* Re: Problem with 'rm -i' in ksh2Janis Papanagnou
12 Jan 25 i     i`- Re: Problem with 'rm -i' in ksh1Lem Novantotto
13 Jan 25 i     `* Iterating over a set in bash (Was: Problem with 'rm -i' in ksh)7Kenny McCormack
13 Jan 25 i      +- Re: Iterating over a set in bash (Was: Problem with 'rm -i' in ksh)1Janis Papanagnou
13 Jan 25 i      `* Re: Iterating over a set in bash (Was: Problem with 'rm -i' in ksh)5Lem Novantotto
13 Jan 25 i       +- Re: Iterating over a set in bash (Was: Problem with 'rm -i' in ksh)1Lem Novantotto
14 Jan 25 i       `* Re: Iterating over a set in bash3Keith Thompson
14 Jan 25 i        `* Re: Iterating over a set in bash2Lem Novantotto
14 Jan 25 i         `- Re: Iterating over a set in bash1Janis Papanagnou
11 Jan 25 `* Re: Problem with 'rm -i' in ksh5Christian Weisgerber
11 Jan 25  +* Re: Problem with 'rm -i' in ksh2Kenny McCormack
12 Jan 25  i`- Re: Problem with 'rm -i' in ksh1Janis Papanagnou
12 Jan 25  +- Re: Problem with 'rm -i' in ksh1Janis Papanagnou
12 Jan 25  `- Re: Problem with 'rm -i' in ksh1Keith Thompson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal