Using powerful zsh approach in bash:
First an easy way to extend bash:
~/.runscripts
#load all scripts inside $1 dir run_scripts() { for script in $1/*; do # skip non-executable snippets [ -f "$script" ] && [ -x "$script" ] || continue # execute $script in the context of the current shell . $script done } Include in to .bashrc:
. ~/.run_scripts run_scripts ~/.bashrc.d You can create ~/.bashrc.d/cdhook with:
#!/bin/bash chpwd() { : #no action } cd() { builtin cd "$1"$1 chpwd "$1"$1 } Now is up to you to replace the function:
#list files after cd chpwd() { ls -lah --color }