Return to Snippet

Revision: 5817
at April 5, 2008 18:48 by cczona


Initial Code
# in .bash_profile or other suitable location
shopt -s cdable_vars
export ne="/etc/network/"

# in the shell
source .bash_profile # (just this once, to reload the edited file)
cd ne
pwd  # /etc/network/

Initial URL
http://www.macosxhints.com/article.php?story=2005031814311425

Initial Description
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.

Initial Title
Use shopt to reference bash paths as variables

Initial Tags
Bash

Initial Language
Bash