How do you run a shell command/script automatically when entering/cd-ing a directory on Snow Leopard?
Add the following to your ~/.bash_profile
:
function cd {
# actually change the directory with all args passed to the function
builtin cd "$@"
# if there's a regular file named "todo.txt"...
if [ -f "todo.txt" ] ; then
# display its contents
cat todo.txt
fi
}
It's possible you already have a similar function for cd
— just extend that one to print the contents of todo.txt
if it exists.