Unix Technical Forum

Can't undo readonly attribute of a NAME

This is a discussion on Can't undo readonly attribute of a NAME within the Debian Linux support forums, part of the Debian Linux category; --> Distro= Debian BASH= 2.05b.0(1)-release (i386-pc-linux-gnu) Whether logged in as user or root in xterm or even CTRL-ALT-F1 for a ...


Go Back   Unix Technical Forum > Unix Operating Systems > Debian Linux > Debian Linux support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 06:55 AM
scarboni
 
Posts: n/a
Default Can't undo readonly attribute of a NAME

Distro= Debian
BASH= 2.05b.0(1)-release (i386-pc-linux-gnu)

Whether logged in as user or root in xterm or even CTRL-ALT-F1 for a
TTY1 as user or root I can declare -r NAME=Something but each time I try
to declare +r NAME all I get is:
bash: declare: person: readonly variable

also readonly -n NAME seems to do nothing.

All I can figure is that there's some BASH "failsafe" config setting but
don't know where to start looking. Googling is useless - seems like
no on else ever had this issue thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-19-2008, 06:55 AM
Chris F.A. Johnson
 
Posts: n/a
Default Re: Can't undo readonly attribute of a NAME

On Fri, 13 May 2005 at 08:20 GMT, scarboni wrote:
> Distro= Debian
> BASH= 2.05b.0(1)-release (i386-pc-linux-gnu)
>
> Whether logged in as user or root in xterm or even CTRL-ALT-F1 for a
> TTY1 as user or root I can declare -r NAME=Something but each time I try
> to declare +r NAME all I get is:
> bash: declare: person: readonly variable
>
> also readonly -n NAME seems to do nothing.
>
> All I can figure is that there's some BASH "failsafe" config setting but
> don't know where to start looking. Googling is useless - seems like
> no on else ever had this issue thanks in advance.


The variable is readonly; you cannot modify it in any way.

From the declare section of the bash man page:


The return value is
0 unless .... an attempt is made to turn off read-
only status for a readonly variable,

--
Chris F.A. Johnson <http://cfaj.freeshell.org>
================================================== ================
Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
<http://www.torfree.net/~chris/books/ssr.html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-19-2008, 06:55 AM
scarboni
 
Posts: n/a
Default Re: Can't undo readonly attribute of a NAME

Chris F.A. Johnson wrote:
> On Fri, 13 May 2005 at 08:20 GMT, scarboni wrote:
>
>>Distro= Debian
>>BASH= 2.05b.0(1)-release (i386-pc-linux-gnu)
>>
>>Whether logged in as user or root in xterm or even CTRL-ALT-F1 for a
>>TTY1 as user or root I can declare -r NAME=Something but each time I try
>>to declare +r NAME all I get is:
>>bash: declare: person: readonly variable
>>
>>also readonly -n NAME seems to do nothing.
>>
>>All I can figure is that there's some BASH "failsafe" config setting but
>> don't know where to start looking. Googling is useless - seems like
>>no on else ever had this issue thanks in advance.

>
>
> The variable is readonly; you cannot modify it in any way.
>
> From the declare section of the bash man page:
>
>
> The return value is
> 0 unless .... an attempt is made to turn off read-
> only status for a readonly variable,
>


Thanks for the clarification, Chris; upon re-examination of the man page
that does make perfect sense. The confusion arose because whenever I
type "help readonly" at the prompt I receive the following:
readonly: readonly [-anf] [name[=value] ...]
.....An argument of `-n' says to remove the readonly property from
subsequent NAMEs....***

Typing: readonly -n NAME returns no error yet the readonly attribute is
not changed. Is this either a deprecated parameter or am I
misunderstanding the context of the readonly built-in? I'm suspecting
the former as the readonly section of the bash man page does not cover
the -n option.

It's not really important just curious because I'm going through "A
Practical Guide To Linux" & in there Sobell states you can "declare +r
NAME" & since it wasn't working I just thought something was going on w/
my configuration but I suppose it's just some sort of historical issue
I'll discover further on down the road. TY.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-19-2008, 06:55 AM
Bill Marcum
 
Posts: n/a
Default Re: Can't undo readonly attribute of a NAME

On Fri, 13 May 2005 08:20:31 +0000, scarboni
<scarboni888@hotmail.com> wrote:
> Distro= Debian
> BASH= 2.05b.0(1)-release (i386-pc-linux-gnu)
>
> Whether logged in as user or root in xterm or even CTRL-ALT-F1 for a
> TTY1 as user or root I can declare -r NAME=Something but each time I try
> to declare +r NAME all I get is:
> bash: declare: person: readonly variable
>
> also readonly -n NAME seems to do nothing.
>
> All I can figure is that there's some BASH "failsafe" config setting but
> don't know where to start looking. Googling is useless - seems like
> no on else ever had this issue thanks in advance.


The readonly attribute only lasts for the duration of the shell.
(readonly variables may be declared in shell startup files, to prevent
users from changing them).

--
Test-tube babies shouldn't throw stones.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:05 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com