short story is, I probably need a simple loop in bash which checks periodically whether the size of a given file has changed or not since last checked.

Long story, I will be downloading a file *my\_file.txt* using Firefox. I'd like to run a *command* after the download has completed. Firefox doesn't seem to provide dbus calls that I could make use of. There exist some add-ons with said feature but I need a rather reliable solution. So I thought I could run a bash script that periodically checks whether the size of *my\_file.txt* is changing over time, or has settled. The file is a text file of size <=5mb and will be downloaded *locally*, so it is pretty reliable and the download should run linearly (no disconnections, server issues etc). 

Could you help me write such simple bash script? The frequency of probing the file really seems to be key to make the thing work effectively. Like I said, it's a text file of <=5mb but can be as small as 10kb, residing on a SSD drive.

Also, maybe there are better ways to accomplish this? Like I say, I need a reliable solution that runs in Linux with minimal dependencies. Maybe a download manager? Or any file monitoring daemon? Or a filesystem API for this? Or use access time rather than size?