Each time I make some changes to a file and save, I'd like a command to run. I can set up a Ruby script that could monitor the file and run the command as I'd like, but it occurs to me that there should be some simple Unix way to do this. Is there? I'm on Ubuntu 8.10, to be slightly less vague.
incron was suggested, and looks good. But I'm having trouble getting it to work (edit: the command doesn't seem to run when I save a file in the specified directory, or my command is faulty). I installed incron and set up my user's incron table using incrontab, and added the user to the allowed list. My specific situation is editing a TeX file. I want the command to render it as a PDF to run every time I edit and save the TeX file. So this is the incron table entry I came up with:
/home/ehsanul/Documents/latex IN_CLOSE_WRITE echo $@/$# | grep \\.tex$ | xargs xelatex
What am I doing wrong?