Skip to main content
Added note about posible breakage of cd command
Source Link

Building upon @teknopaul his answer, I added a little hack that ensures the previous aliases get tossed by replacing the current shell with a new bash instance using exec:

cd () {
  builtin cd "$@" && exec bash
}

if [ -f $PWD/.aliases ]; then
    . $PWD/.aliases
fi

Note that this will break chaining cd with consecutive command executions

Building upon @teknopaul his answer, I added a little hack that ensures the previous aliases get tossed by replacing the current shell with a new bash instance using exec:

cd () {
  builtin cd "$@" && exec bash
}

if [ -f $PWD/.aliases ]; then
    . $PWD/.aliases
fi

Building upon @teknopaul his answer, I added a little hack that ensures the previous aliases get tossed by replacing the current shell with a new bash instance using exec:

cd () {
  builtin cd "$@" && exec bash
}

if [ -f $PWD/.aliases ]; then
    . $PWD/.aliases
fi

Note that this will break chaining cd with consecutive command executions

Source Link

Building upon @teknopaul his answer, I added a little hack that ensures the previous aliases get tossed by replacing the current shell with a new bash instance using exec:

cd () {
  builtin cd "$@" && exec bash
}

if [ -f $PWD/.aliases ]; then
    . $PWD/.aliases
fi