title: How can I avoid having sqlite3 create a new empty database when calling sqlite3 fileName where no file name fileName exists?
body: <p>If I use</p>
  
  <pre><code>$ sqlite3 fileName
  sqlite&gt; .s
  sqlite&gt;_
  </code></pre>
  
  <p>and there is no file named fileName, sqlite3 creates a new empty database. Is there a way to avoid this? Ideally, I would like it to retry a couple of times if the file is not found, then fail with an error message. Something like this:</p>
  
  <pre><code>$ sqlite3 --failIfNoSuchFile --retry 3 fileName
  sqlite&gt; No such file, retrying ...
  sqlite&gt; No such file, retrying ...
  sqlite&gt; No such file, retrying ...
  sqlite&gt; Aborting...
  Error: No file named fileName
  $_
  </code></pre>
  
  <p>Is something like this possible?</p>
  
  <p>The reason I ask is because an existing database we had was crushed and replaced by this new blank database just because a networking problem prevented sqlite3 from finding the file in the first place but did not prevent it from creating the new empty one (and crushing the old one)! At least, that's the most probable theory we've come up with to explain the sudden emptiness of the database (even the structure was gone, <code>.s</code> returned nothing and the file size was 0)</p>
  
  <p>Any ideas?</p>
  
  <p>btw, in the actual context, a tcl script connects to the database and inserts data. The problem appeared as a "table not found" error and we found out the database file was empty..</p>