[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rewriting a readonly var should exit
From: |
Chet Ramey |
Subject: |
Re: rewriting a readonly var should exit |
Date: |
Tue, 15 Dec 2015 09:29:17 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/15/15 6:12 AM, Aurelien ROUGEMONT wrote:
> Bash Version: 4.3
> Patch Level: 30
> Release Status: release
>
> Description:
> in the posix shell specification [1] when a script tries to to
> overwrite a readonly variable it should crash the script.
>
> Repeat-By:
> #!/bin/bash
> readonly rovar="goodvalue"
> rovar="badvalue"
> echo "You should not see this message"
>
> Fix:
> the bash interpreter should exit when the readonly var is being asked
> for an overwrite
The shell exits in this case when it is running in Posix mode.
- --
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iEYEARECAAYFAlZwI7IACgkQu1hp8GTqdKsyxACgk42MVS+jQeKSxZ6IoKQu0yaZ
ZDoAn3HrbC7JYivv3fOIS1akKf2XNFkh
=18vR
-----END PGP SIGNATURE-----