On Wed, Mar 27, 2019 at 02:06:51PM +0100, joerg...@snafu.de wrote:
>       If I declare a global read-only variable and I try to declare a local 
> variable with that name, I can not create
>       the local variable.
>       I expect that local variables can be declared independently for the 
> global variables.

The purpose of the readonly flag on shell variables is to support the
restricted shell.  I will pause while you laugh and/or cry.

In order for a restricted shell to have half a chance of working (keeping
the user imprisoned), the PATH variable has to be immutable.  If the
user can modify PATH, they can run a real shell and escape.

So, in rbash and friends, PATH gets marked readonly, and bash treats
the readonly flag as sacrosanct.  Allowing a user to work around it
simply by creating a function would let them break out of the restricted
shell too easily.

Readonly is forever.

Reply via email to