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: Fri, 27 Jan 2023 11:36:05 -0600

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.

On 1/27/23, Dennis Williamson <dennistwilliamson@gmail.com> wrote:
> On Fri, Jan 27, 2023 at 9:33 AM Peng Yu <pengyu.ut@gmail.com> wrote:
>
>> If you know a variable can be used (under what condition), then you
>> can just list it.
>>
>> I only find REPLY is appropriate to be used (when 'read' is not used).
>> But there may be other variables that can also be used. For example,
>> probably BASH_VERSION, as I seldom need to check the bash version
>> because I just use the version that works. If it has any problem with
>> the version that I use, I will use another version. But there is no
>> description of whether it will be changed back to its original value
>> in the manual. So I don't know if I can assume so.
>>
>> $ echo $BASH_VERSION
>> 5.1.8(1)-release
>> $ BASH_VERSION=x
>> $ echo $BASH_VERSION
>> x
>>
>> Thus, just reading the manual is not sufficient. Hence, the question
>> is legitimate, not as you think illegitimate.
>>
>> On 1/26/23, Koichi Murase <myoga.murase@gmail.com> wrote:
>> > 2023年1月26日(木) 23:12 Peng Yu <pengyu.ut@gmail.com>:
>> >> Yes. I have full control of the scripts that I use. I am not trying to
>> >> use some other people's scripts for this purpose. So the restriction
>> >> that you mentioned does not apply to me. I want to understand in this
>> >> situation what variables can be used as temp variables (and under what
>> >> conditions, if there are restricted conditions like in REPLY).
>> >
>> > There are no special Bash variables that can be used for unintended
>> > purposes unconditionally. Then the condition that a variable can be
>> > used as a temporary variable is theoretically that you do not use the
>> > variable for the original purpose, as I have written in the previous
>> > reply. The usage of each variable is described in Bash Reference
>> > Manual Sec. 5.2, so you can check the description of each variable
>> > there and will immediately know what would be the condition for each
>> > variable. I know that you do not expect us to just copy and paste the
>> > contents of Sec. 5.2 here, but then what are you expecting us for
>> > replies?
>> >
>>
>>
>> --
>> Regards,
>> Peng
>>
>>
> By my calculation(1) there are well over TWO HUNDRED TRILLION potential
> variable names of length eight (to choose an arbitrary limit) or less in
> Bash. Use any of those (or any of the very many more longer ones(2)) and
> leave the (few DOZEN) built in variables alone.
>
> Somewhere among all those X-illions are actual meaningful words and
> phrases. If you find one you really like, you can reuse IT if that's what
> floats your boat.
>
> So stop. Just STOP.
>
> 1: (26 lc alpha + 26 uc alpha + underscore) * (26 lc alpha + 26 uc alpha +
> 10 num + underscore) ** 7
>
> 2: (adding just one more character to the length jumps the total to over 13
> quadrillion)
>
> --
> Visit serverfault.com to get your system administration questions answered.
>


-- 
Regards,
Peng



reply via email to

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