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: Thu, 26 Jan 2023 08:12:19 -0600

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).

On 1/25/23, Koichi Murase <myoga.murase@gmail.com> wrote:
> 2023年1月26日(木) 2:12 Peng Yu <pengyu.ut@gmail.com>:
>> I know this list. But what are the safe ones to use? I know REPLY can
>> be used when `read` is not used.
>
> So, you are trying to use these existing variables for unrelated
> purposes. I believe any of these reserved variables shouldn't be used
> for unrelated purposes. Even if we use the variables when it is safe,
> whether it is safe or not depends on what feature the shell script
> uses. If the script uses a variable also for the original purpose,
> that variable cannot be safely used for other purposes.
>
> In short, if you assume an arbitrary script, none of these variables
> are safe to use for other purposes. If you assume a particular script,
> the safe set of variables totally depends on the script. But,
> generally, you shouldn't use the variables for other purposes.
>


-- 
Regards,
Peng



reply via email to

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