Article View: comp.unix.shell
Article #226Re: Back To CS Basics. Fuck AI
From: Helmut Waitzmann
Date: Tue, 20 Oct 2026 22:54
Date: Tue, 20 Oct 2026 22:54
43 lines
3182 bytes
3182 bytes
Janis Papanagnou <janis_papanagnou+ng@hotmail.com>:
> On 2026-10-17 22:47, Lawrence D’Oliveiro wrote:
> I've just done this ("a script change while it's running") [*]
>
> [*] What I've done was to run the following script "dynchg.sh"
>
> while read ; do
> echo $REPLY
> done
>
> and change it (from another terminal) while it runs by
>
> sed -i '2p' dynchg.sh
>
As the "-i" option is not defined by the POSIX standard but by GNU
sed, I assume that your example uses GNU sed.
GNU sed's "-i" option does not edit the file in place. Rather it
sends its output to a new file (instead of to standard output),
then removes (or renames) the name of the original file.
Finally, the name of the new file is renamed to be the no more
existing name of the original file.
=> GNU sed doesn't modify the original shell script, which has
been opened by the shell.
Therefore the shell won't see anything of the new file but rather
stick to the already opened original file (even, if that original
file hasn't got any file name).
> I could even remove that file from the directory and it still
> processes data as expected.
>
Yes. As long as the shell doesn't close the file descriptor
accessing the original file, it will continue to access the
original unmodified file.
Technical Details
Message-ID:
<83se20c7ao.fsf@helmutwaitzmann.news.arcor.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com> <POycnb0WPpTmPEz3nZ2dnZfqn_ednZ2d@giganews.com> <87ik32455m.fsf@solcaium.us> <6ad33478$0$28048$426a74cc@news.free.fr> <11b0ms8$iems$8@dont-email.me> <11b0pbe$3pvda$2@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Helmut Waitzmann <nn.throttle@erine.email> Newsgroups: comp.os.linux.misc,comp.unix.shell Subject: Re: Back To CS Basics. Fuck AI Date: Wed, 21 Oct 2026 00:54:07 +0200 Organization: A noiseless patient Spider Lines: 43 Sender: Helmut Waitzmann <12f7e638@mail.de> Message-ID: <83se20c7ao.fsf@helmutwaitzmann.news.arcor.de> References: <18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com> <POycnb0WPpTmPEz3nZ2dnZfqn_ednZ2d@giganews.com> <87ik32455m.fsf@solcaium.us> <6ad33478$0$28048$426a74cc@news.free.fr> <11b0ms8$iems$8@dont-email.me> <11b0pbe$3pvda$2@dont-email.me> Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@erine.email> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Date: Tue, 20 Oct 2026 22:56:58 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3632615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/L54adp85dmjRSwSw0ByTmp/N44bCSprc="; posting-host="bed05299f16fcadc522fe32d19572992" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:0mXTSM/gOsyNpRRY+VccPWPEGBU= sha1:udtO+H8Sw2PWGvvUKx6Pf+MsOiw= sha256:ekm2AoQZ2yOhvNYTfmoK89vANAAsNhel6prYtF8FS3U= sha1:pVEbO/LAGB1iTOyKGH/bkDw4iPQ= sha256:XKaugLQveXXQ8T0PAH/gwKLTO/q9Qrmcg79g0sVWHsU= Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@erine.email> Mail-Copies-To: nobody