4 ms·
Put the following in your .bashrc instead: shopt -s autocd If you type a directory in the command-line, it’ll cd into it, e.g.: $ .. # cd .. $
by hk__2 13y ago
Put the following in your .bashrc instead:
shopt -s autocd
If you type a directory in the command-line, it’ll cd into it, e.g.:
$ .. # cd ..
$ ~ # cd ~
$ foo # cd foo
I can’t live without this.
- AlexanderDhoore 13y agoVery cool, thanks! Although: On OS X: "-bash: shopt: autocd: invalid shell option name" Apple and their outdated tools... It gets annoying after a while.
- rangibaby 13y agoInstall new bash using brew :-) (1) http://apple.stackexchange.com/questions/55412/cd-to-a-directory-by-typing-its-name http://apple.stackexchange.com/questions/55412/cd-to-a-direc...
- binofbread 13y agoI believe this is set by default in oh-my-zsh as well.
- cgore 13y agoIn Zsh, you can set it so that specifying a bare directory goes to the directory as well, for any directory. Just do setopt autocd