Check if file exists

I need to check whether a file exists and has been changed.

The file should contain a specific string. The file should also have been changed within the last ten seconds.

How do I do that?

We need to know what UNIX you have and what shell you use. The answers would be all over the place without that information. Thanks.

Please also show us what you have tried to solve this problem on your own.

With well over 100 posts we would expect you to be able to come close to solving this on your own. Please show us where you are stuck.

Yes, and please follow forum rules and search the forums before asking questions.

I just searched the forum using the title of this discussion (Check if file exists) and ....

Showing results 1 to 25 of 1218

This question has been asked and answered countless times. This is why we have a long standing forum rule:

I am starting to see way too many questions from site members who are not searching the forums before asking their question(s). Please follow the forum rules or I am going to start issuing infractions to members who do not follow forum rules and waste the valuable time of our members by asking questions before the search.

locoroco, as Don mentioned, you have over 100 posts here. Why do you post a question without search the forums?

I have added a public entry to your user notes here, locoroco:

https://www.unix.com/usernote.php?do=viewuser&u=302092114