Deutsch English Français Italiano |
<vm3tmq$20qtd$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Lem Novantotto <Lem@none.invalid> Newsgroups: comp.unix.shell Subject: Re: Iterating over a set in bash (Was: Problem with 'rm -i' in ksh) Date: Mon, 13 Jan 2025 20:39:54 -0000 (UTC) Organization: A noiseless patient Spider Lines: 22 Message-ID: <vm3tmq$20qtd$1@dont-email.me> References: <vlsqmt$fem4$1@dont-email.me> <vm0ela$15i9h$1@dont-email.me> <vm0inq$2st9j$1@news.xmission.com> <vm0no6$17127$1@dont-email.me> <vm1v8a$2tk9v$1@news.xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 13 Jan 2025 21:39:54 +0100 (CET) Injection-Info: dont-email.me; posting-host="7b4523ae5049bb493c8bce97e3a45f1f"; logging-data="2124717"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hD/LmBwXrI+5LhckUGjEXpuHofEbYIDE=" User-Agent: Pan/0.160 (Toresk; ) Cancel-Lock: sha1:uSEsVB4ezyF1euFKNq2gB7VvwGI= Bytes: 1749 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