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: Koichi Murase
Subject: Re: All bash variables that can be used as temp variables?
Date: Thu, 26 Jan 2023 12:19:13 +0900

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.



reply via email to

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