Trigger `inotifywait` action when starting waiting for changes?

73 views Asked by At

I have a bunch of scripts that watch some file for changes:

while inotifywait -e close_write ~/somefile.someext;
  do THINGS
  done

How can I execute THINGS not only when a file changes, but also when first starting the script? I can duplicate the command at the front like below, but ideally I would just pass an option to inotifywait that says "Do it now as well as when this file changes" (THINGS can get rather complex and I would rather not copy it and have to change things in two places (DRY))

THINGS;
while inotifywait -e close_write ~/somefile.someext;
  do THINGS
  done 
0

There are 0 answers