ondir is a small program to automate tasks specific to certain directories. It
works by executing scripts in directories when you enter and leave them.

Scripts in the doc subdirectory show how to automate this when using either
BASH or TCSH.

An example of its usefulness is when editing web pages. I have a umask of 077
by default but when creating web pages in ~/public_html the web content has
to be readable by the user the web server runs as. By putting a script called
".onenter" in my ~/public_html directory whenever I cd into this directory
or any of its subdirectories this script will be executed. So I just do this:

~/public_html/.onenter:
	umask 022

Now this is good, but what happens when you leave the public_html directory?
You want to reset your umask to the default, so there is a complementary script
called ".onleave":

~/public_html/.onleave
	umask 077

And that's all it does. Simple, but effective. 

ondir takes one parameter, the directory you are leaving.

Note that these scripts will be executed when you pass THROUGH the directory 
as well. Using the preceding example, typing "cd ~/public_html/mywebpage" will 
execute the .onenter in ~/public_html. The reverse is also true: when leaving 
a path, all .onleave's in the intermediate directories are executed.

Another useful example is if you have a project with its own "bin" directory.
You can use the following:

~/projects/myproject/.onenter
	PATH=$PATH:$ONDIRWD/bin

~/projects/myproject/.onleave
	PATH=`echo $PATH | sed -e "s,:$ONDIRWD/bin,,g"`

Example of usage:

[alec@cavern:~]umask
077
[alec@cavern:~]cd public_html
[alec@cavern:~]umask
022
[alec@cavern:~]
