Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'cdable_vars is also nice' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
cdable_vars is also nice
Authored by: clh on Mar 21, '05 08:16:26PM
Check out the bash command shopt -s cdable_vars

From the man bash page:

cdable_vars

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.

With this set, if I give the following bash command:

export d="/Users/chap/Desktop"

I can then simply type

cd d

to change to my Desktop directory.

I put the shopt command and the various export commands in my .bashrc file.

[ Reply to This | # ]

cdable_vars is also nice
Authored by: aggie4life on Jun 14, '09 11:10:49AM

Not to change the purpose of the thread but could someone explain the difference between .bash_profile, .bashrc, and .bash_aliases. It seems like you could just "put all your junk" in one of them and be done with it, then there's two less files you have to worry about.



[ Reply to This | # ]
cdable_vars is also nice
Authored by: aggie4life on Jun 14, '09 11:19:07AM

Addition to my post above: my point reference is an informed user, but not someone who makes a living in the unix world.



[ Reply to This | # ]