bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: History of bash's support for self-modifying shell scripts?


From: Ángel
Subject: Re: History of bash's support for self-modifying shell scripts?
Date: Tue, 11 Sep 2018 01:11:41 +0200

On 2018-09-09 at 22:25 -0700, Josh Triplett wrote:
> (I don't want to use this mechanism myself; I'm asking because I'm
> working on a project that needs to care about various shells'
> compatibility requirements, and I wanted to find out more about this
> unusual corner case.)

The Thompson shell (up to Sixth Edition UNIX) supported a goto command
that was implemented as an external command(!) that moved the
filepointer to the label location (marked by the : command).

The PWB shell (Mashey shell) initially had if/switch/while, but they
used a goto to move the filepointer.

This tells us that self-modifying scripts would be possible on these
shells, and probably they also worked on th original bourne shell.

With these level of trickery, I wouldn't be surprised if some
self-modifying shell scripts were in use at the time (or were thought to
be) and bash was coded this way in order not to break them
(I can't really come up with a good use case for this feature, though). 

You may find these resources interesting
https://etsh.io/
https://www.in-ulm.de/~mascheck/


Regards




reply via email to

[Prev in Thread] Current Thread [Next in Thread]