[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: typeset -r prevents local variable of same name.
From: |
Chet Ramey |
Subject: |
Re: typeset -r prevents local variable of same name. |
Date: |
Wed, 16 Feb 2011 22:13:56 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 |
On 2/13/11 3:17 PM, steveo@syslang.net wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i386
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
> -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
> -fasynchronous-unwind-tables
> uname output: Linux saturn.syslang.net 2.6.27.41-170.2.117.fc10.i686.PAE #1
> SMP Thu Dec 10 10:48:30 EST 2009 i686 athlon i386 GNU/Linux
> Machine Type: i386-redhat-linux-gnu
>
> Bash Version: 3.2
> Patch Level: 39
> Release Status: release
>
> Description:
> First, I already submitted this bug from work, but I didn't
> realize that the address I sent from would not be allowed to receive
> a response. This address will work fine.
>
> If I declare a variable at the top scope using -r, it will prevent me
> from declaring a local copy in a subroutine. This problem happens in
> this version of bash as well as in bash4 under Fedora 14.
This is intentional. A variable is declared readonly for a reason, and
readonly variables may not be assigned to. I don't believe that you
should be able to use a function to circumvent this.
Chet
--
``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/
- typeset -r prevents local variable of same name., steveo, 2011/02/13
- Re: typeset -r prevents local variable of same name.,
Chet Ramey <=
- Re: typeset -r prevents local variable of same name., Clark J. Wang, 2011/02/16
- Re: typeset -r prevents local variable of same name., Steven W. Orr, 2011/02/17
- Re: typeset -r prevents local variable of same name., Chet Ramey, 2011/02/17
- Re: typeset -r prevents local variable of same name., Eric Blake, 2011/02/17
- Re: typeset -r prevents local variable of same name., Chet Ramey, 2011/02/17
- Re: typeset -r prevents local variable of same name., Eric Blake, 2011/02/17
- Re: typeset -r prevents local variable of same name., Chet Ramey, 2011/02/18
Re: typeset -r prevents local variable of same name., Eric Blake, 2011/02/17