Help with shell script for know when a file change it

Hi,

I�d like to know how to program a shell script for know when a file changes and based on that make another tasks all this in real time.. Thanks

Removed (didn't read properly)

What OS are you on? Linux has the inotifywait command. It waits (does nothing) and causes the script to sit there until a file changes:

while true
do
  inotifywait -e modify myfile
  echo 'file myfile changed' | mailx -s 'file change'  me@mycompany.com
  # put command here to run other programs
done