linux bash 变量
How to unimport an imported variable in Bash on Linux? For example, first, I export a variable MODE
like
如何在Linux上的 Bash中取消导入导入的变量? 例如,首先,我导出一个变量MODE
export MODE=debug
but I want to unexport the MODE (not turn to be “”, should be truly non-defined).
但是我想取消导出MODE(不要变成“”,应该是真正未定义的)。
You can
您可以
unset MODE
For your reference:
供你参考:
unset [-fv] [-n] [name ...]
For each name, remove the corresponding variable or
function. If the -v option is given, each name refers
to ashell variable, and that variable is removed.
Read-only variables may not be unset. If -f is speci‐
fied, each name refers to a shell function, and the
function definition is removed. If the -n option is
supplied, and name is a variable with the nameref
attribute, name will be unset rather than the variable
it references. -n has no effect if the -f option is
supplied. If no options are supplied, each name
refers to a variable; if there is no variable by that
name, any function with that name is unset. Each
unset variable or function is removed from the envi‐
ronment passed to subsequent commands. If any of
COMP_WORDBREAKS, RANDOM, SECONDS, LINENO, HISTCMD,
FUNCNAME, GROUPS, or DIRSTACK are unset, they lose
their special properties, even if they are subse‐
quently reset. The exit status is true unless a name
is readonly.
Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。
翻译自: https://www.systutorials.com/how-to-unexport-an-exported-variable-in-bash-on-linux/
linux bash 变量