使用shopt将bash路径作为变量引用

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用shopt将bash路径作为变量引用相关的知识,希望对你有一定的参考价值。

Check out the bash command 'shopt -s cdable_vars' From the man bash page: If set, an argument to the cd builtin command that is not a directory is assumed to be the name of a variable whose value is the directory to change to.
  1. # in .bash_profile or other suitable location
  2. shopt -s cdable_vars
  3. export ne="/etc/network/"
  4.  
  5. # in the shell
  6. source .bash_profile # (just this once, to reload the edited file)
  7. cd ne
  8. pwd # /etc/network/

以上是关于使用shopt将bash路径作为变量引用的主要内容,如果未能解决你的问题,请参考以下文章