linux bash 变量_如何在Linux上的Bash中取消导出导出的变量?

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 变量

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值