Sujet : Re: Iterating over a set in bash (Was: Problem with 'rm -i' in ksh)
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shellDate : 13. Jan 2025, 10:08:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vm2l77$1ni2s$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 13.01.2025 03:54, Kenny McCormack wrote:
In general, when I need to iterate over a set (in bash), I use "mapfile".
[...]
I think more or less the same is available in ksh.
Not that I'd know of. - Maybe getting something similar using some
standard mechanisms? - If I understand 'mapfile' correctly it may
(basically) do something like IFS=$'\n' arr=( $( ... ) ) ?
Oh, and another thing of interest to the original thread. We were talking
about whether the real underlying problem in the "rm" command could or
should be fixed. I did some reading and some testing. "man rm" (on Linux)
does mention stdin being a terminal - implying, somewhat obliquely, that
the -i option checks that and behaves differently if stdin is not a
terminal.
In case stdin is not a terminal I'd not expect the flushing of the
prompts; in case that condition is even checked I'd rather expect
a warning message. (But I haven't thought about that to any depth.)
Janis
[...]