Deutsch   English   Français   Italiano  
<vm0ela$15i9h$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: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.unix.shell
Subject: Re: Problem with 'rm -i' in ksh
Date: Sun, 12 Jan 2025 14:04:41 +0100
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <vm0ela$15i9h$1@dont-email.me>
References: <vlsqmt$fem4$1@dont-email.me> <vltjc3$htgh$1@dont-email.me>
 <vlttua$la3m$1@dont-email.me> <vm07mh$13cnk$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 12 Jan 2025 14:04:42 +0100 (CET)
Injection-Info: dont-email.me; posting-host="c3d140746c7c5fdf39b74eedc856b652";
	logging-data="1231153"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+JxaVcC9FkWN/DGZPdzOC1"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:WAsWBf5vk2lDYYLDwoUbpf/BXJs=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <vm07mh$13cnk$5@dont-email.me>
Bytes: 3208

On 12.01.2025 12:05, Lem Novantotto wrote:
> Il Sat, 11 Jan 2025 15:07:05 +0100, Janis Papanagnou ha scritto:
> 
>> Yes, just these commands in a script work also in my environment. (That
>> was what I meant when I wrote: "constructing a test sample from
>> scratch";
>> it didn't lead me anywhere, since it just wasn't reproducible in a
>> primitive context like that.)
>>
>> I think it must have to do with the shell environment that in some way
>> affects how 'rm -i' behaves. But I have no idea how an external
>> (shell-environment-)condition could look like that makes an executed
>> program like 'rm' behave as if all '-i' confirmations are "magically"
>> considered as being each answered by "no" (without me typing anything).
> 
> Oh, I'm sorry for my mistake.

No worries. :-)

> 
> Letting alone the redirection of standard input, or the "cron or whatever" 
> hypothesis, that didn't seem to fit your situation, and since the command 
> works well itself in a primitive context, it seem strange to me that the 
> cause can be found in your ksh configuration, too...
> 
> So, I can't think of anything... which doesn't impress me much: it happens 
> frequently. ;)
> 
> However: if you add in the script "< /dev/tty" as in
> 
> rm -i file < /dev/tty
> 
> does it make any change?

Erm, yes. - Then it just works. :-)

I'm now feeling a bit stupid; we were discussing the effect of some
(possibly invisible) redirection without me taking the constructive
approach to just invent that redirection as you propose it. Thanks!

The previously observed effect still unsettles me, but since I want
just a working solution the simple workaround/fix is perfect!

> 
> rm -i is called in a pipe? Exec? Subshell?

It's called in a (ksh-)function within a structure like this

  function f { ... rm ... }
  p1 | p2 | while read ... do ... f ... done
  f

> 
> I know you know. I'm out of ideas.

One fitting idea suffices :-) - Thanks again!

Janis