On 12/11/22 9:37 PM, L A Walsh wrote:
This is mostly a 'nit', but I noticed I had
"typeset -xr"
in one of my scripts to mean export+read-only and
was wondering why
"export -r"
was disallowed (err message):
bash: export: -r: invalid option
export: usage: export [-fn] [name[=value]
On 2022/12/11 20:47, Lawrence Velázquez wrote:
This happens because "declare"/"typeset" creates local variables
within functions. Using -g works around this...
$ Export() { declare -gx "$@"; }
$ Export -r foo=1
$ declare -p foo
declare -rx foo="1"
...but now