help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: All bash variables that can be used as temp variables?


From: Peng Yu
Subject: Re: All bash variables that can be used as temp variables?
Date: Sat, 28 Jan 2023 12:20:31 -0600

On 1/27/23, Koichi Murase <myoga.murase@gmail.com> wrote:
> 2023年1月28日(土) 2:36 Peng Yu <pengyu.ut@gmail.com>:
>> I was referring to the bash variables defined in the manual. Your
>> reply doesn't make sense if you know the scope is just those variables
>> defined in the manual.

I hope my last reply clarifies the scope of the discussion in this thread.

> You are not explicit about the scope. The reply from Dennis
> recommending the use of other variable names makes sense when one
> assumes that you are talking about practical and sensible scripting,
> which is a natural guess for those who haven't discussed stuff with
> you so many times.

No. I've considered it. But for my specific scenario, that is not an
option, because if the variables are declared in the global namespace,
it can inadvertently conflict with other scripts that compete for the
same global namespace.

My current solution is to declare a global associative array. Then the
keys of the array can include separators like "/" to denote different
levels of namespaces. However, if I can just use some bash-manual
defined variables as temp variables, then I don't need to use an
associative array with long key names, which will slow down scripts
(as people have discovered about the negative runtime impact of using
long variable names).

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]