I stumbled over this behavior:
from another shell (tcsh in my case) call ksh after first exporting some
parameter from tcsh, i.e. in a running tcsh do
% setenv a 123
% ksh
within the called ksh one gets of course
echo $a # -> 123
but after
typeset -r a
one gets
echo $a # -> Null.
I suspect the `typeset -r a' somehow masks the exported parameter of the
same name which is such lost forever within the running ksh?
question 1: is this behavior intentional? in bash and zsh `a' maintains
its original value, which is what I would have expected in ksh, too.
question 2: what is the best way for testing whether a parameter is
readonly? I came up with
s=$(typeset -r)
([[ -z "$s" ]] || [[ -n "${s/@(*$'\na'|a)=*}" ]]) && typeset -r a=$a
(which checks if there are any readonlys at all and if so if parameter `a'
is actually part of them)
in order to enforce a readonly parameter with the original value. seems to
be correct but is probably way too complicated.
thanks
joerg
ps: oberved with 93u.
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users