tags:

views:

26

answers:

2

I want to overload the functionality of cd in bash so that I can do the following checks:

if the directory is not in DIRSTACK -> pushd dir

else cd dir (or cd ~#)

However now I get a recursive loop when trying to cd

The reason for this is that I am trying to work around the fact that bash does not support set dunique

+3  A: 

Use the builtin called "builtin":

cd () {
    builtin cd "$@"
}
Dennis Williamson
A: 

See also here for various attempts to workaround this.

ghostdog74