[Top][All Lists]

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

Re: Use readonly wherever possible?

From: Greg Wooledge
Subject: Re: Use readonly wherever possible?
Date: Wed, 6 May 2020 11:17:54 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Wed, May 06, 2020 at 12:04:08PM -0300, Maroloccio wrote:
> or general thoughts on marking explicitly as "const" what is
> de-facto "const":
> *

You're bringing concepts from other languages into bash, and expecting
them to play out the same way in bash that they do in these other

Bash isn't like other languages.

unicorn:~$ readonly foo=bar
unicorn:~$ foo() { local foo="$1"; }
unicorn:~$ foo bar
bash: local: foo: readonly variable

The "readonly" flag is HEAVY.  It is not a thing you toss around as if
it only affects a single scope.

reply via email to

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