In Ubuntu I like having
shopt -s autocd
.bashrc file for automatic CD'ing with typing 'cd', i.e. just type the directory name (and probably use tab completion too) and press return and be cd'd to the directory if it exists.
On OSX this isn't valid in my
How can I do a 'depends on' for this? So that I can share and maintain just one .bashrc between the two OS's ?
I know for a file I can do stuff like:
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi
and for an application like tmux that depends on screen I can do
if [[ ! $TERM =~ screen ]]; then if [ -n "$(type -P tmux)" ]; then exec tmux fi fi
but I can I do this kinda thing for whether I can do
shopt -s autocd ?