On Tue, Dec 13, 2022, at 6:38 AM, Emanuele Torre wrote:
> On Tue, Dec 13, 2022 at 03:07:16AM -0500, Lawrence Velázquez wrote:
>> Of course not. I only meant to demonstrate that "export" always
>> creates global variables, so a function that utilizes "declare -gx"
>> actually behaves more like
On Tue, Dec 13, 2022 at 03:07:16AM -0500, Lawrence Velázquez wrote:
> Of course not. I only meant to demonstrate that "export" always
> creates global variables, so a function that utilizes "declare -gx"
> actually behaves more like "export" then your alias does.
This is a little inaccurate.
On Mon, Dec 12, 2022, at 4:43 AM, L A Walsh wrote:
> 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
>>
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]
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
Date:Sun, 11 Dec 2022 18:37:02 -0800
From:L A Walsh
Message-ID: <639693ce.3060...@tlinx.org>
| This seems to be an unnecessary "make-wrong", no? I.e.
| would it cause some syntactic or semantic problem in bash,
| if it were allowed?
Not for me to say, but I
On Sun, Dec 11, 2022, at 9:37 PM, L A Walsh wrote:
> I suppose one could create an alias (despite advice that
> functions are "better" -- in this case a function doesn't work).
> I'm using ':;' for PS1, so cut/paste works:
>
> PS1=':; '
>
> :; Export () {
> :; typeset -x "$@"
> :; }
> :;
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] ...] or export -p
This seems to be an