Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Just switched from tcsh to bash 4.2 on OSX, and autocd was what allowed me to do it. But it seems that by default if you type the name of a directory that also happens to be the name of an executable in my path, autocd is not invoked and the command is run.

Is there a way to change this behavior, so that it assumes I want to be safe and cd into the directory specified?

share|improve this question

1 Answer

You probably can't, which points to an underlying problem concerning why a feature such as autocd can never become standard: it introduces ambiguity. If you switched the behavior: how would you launch a program that is named the same as a currently available subdirectory? It becomes non-deterministic, which is the worst thing a UI can become, imho (and even worse for non-interactive shells, but that is avoidable by simply only setting autocd for interactive shells).

When I say "you probably can't", I mean that I looked through the shopt section of man bash and did not find any such modifier. One can of course fix it by e.g. modifying Bash's source, but I guess your question concerned an available setting to fix this for you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.