LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   file watcher job (https://www.linuxquestions.org/questions/programming-9/file-watcher-job-210289/)

bmeckle 07-27-2004 02:16 PM

file watcher job
 
I need a way to watch for a file and if the file exists run a script.

I think I have most of the pieces.
I am hoping to use cron to run a statement similar to this.

test -e $file
if test -e $file = 0
then execute script
fi

this doesn't seem to work though.
Can anybody tell me what I am doing wrong?


Thanks

bmeckle 07-27-2004 03:40 PM

I found an answer.

if [ -e $file ] ; then
execute script
fi

This is the proper syntax and seems to work great.


All times are GMT -5. The time now is 10:31 PM.