Posted By

cczona on 04/05/08


Bash shopt

Versions (?)

Use shopt to reference bash paths as variables

 / Published in: 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/"
  5. # in the shell
  6. source .bash_profile # (just this once, to reload the edited file)
  7. cd ne
  8. pwd # /etc/network/

Report this snippet  

You need to login to post a comment.