title: How to use inotifywait to wait till a file is created and is written content with timeout
body: <p>I'm using shell command in redhat ubi-minimal. I want to monitor a file &quot;./hello.txt&quot;, which does not exist yet. I want to use <code>inotifywait</code> to monitor this file, and wait until either <code>./hello.txt</code> is created and being written some non-empty content in it, or a fixed timeout.</p>
  <p>Following <a href="https://linux.die.net/man/1/inotifywait" rel="nofollow noreferrer"><code>inotifywait</code>'s man page</a>, I tried:</p>
  <pre><code>inotifywait -m -e create -r --fromfile ./hello.txt -t 30
  </code></pre>
  <p>with <code>-m -e create</code> specifying that this command executes indefinitely until <code>create</code> occur.</p>
  <p>But it only gives:</p>
  <pre><code>Couldn't open ./hello.txt: No such file or directory
  No files specified to watch!
  </code></pre>
  <p>I wonder how to specify the flags of inotifywait to achieve what I'm expecting.</p>