Skip to main content
added 14 characters in body
Source Link
teknopaul
  • 713
  • 7
  • 7

If you add the following function to your .bashrc

function cd () { 
  builtin cd "$@" && [[ -f .aliases ]] && . .aliases;aliases
  return 0
}

Every time you cd to a directory with an .aliases file it will get sourced.

Careful with security if others can create files on your machine.

With this trick aliases never get removed but you can write as much code as you like in the function.

ondir uses this trick and has a ton of bells and whistles.

http://swapoff.org/ondir.html#download

If you add the following function to your .bashrc

function cd () { 
  builtin cd "$@" && [[ -f .aliases ]] && . .aliases; 
}

Every time you cd to a directory with an .aliases file it will get sourced.

Careful with security if others can create files on your machine.

With this trick aliases never get removed but you can write as much code as you like in the function.

ondir uses this trick and has a ton of bells and whistles.

http://swapoff.org/ondir.html#download

If you add the following function to your .bashrc

function cd () { 
  builtin cd "$@" && [[ -f .aliases ]] && . .aliases
  return 0
}

Every time you cd to a directory with an .aliases file it will get sourced.

Careful with security if others can create files on your machine.

With this trick aliases never get removed but you can write as much code as you like in the function.

ondir uses this trick and has a ton of bells and whistles.

http://swapoff.org/ondir.html#download

Source Link
teknopaul
  • 713
  • 7
  • 7

If you add the following function to your .bashrc

function cd () { 
  builtin cd "$@" && [[ -f .aliases ]] && . .aliases; 
}

Every time you cd to a directory with an .aliases file it will get sourced.

Careful with security if others can create files on your machine.

With this trick aliases never get removed but you can write as much code as you like in the function.

ondir uses this trick and has a ton of bells and whistles.

http://swapoff.org/ondir.html#download