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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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. |
| |||
| 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> |
| |||
| 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. |
| ||||
| 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. |