title: How to check whether a sqlite table exist from bash file?
body: <p>I get two files in the same directory:</p>
  
  <pre><code>foo.db
  check.sh
  </code></pre>
  
  <p>in database <code>foo.db</code>, there is a table called <code>foo.db.1</code>, and in the <code>check.sh</code>, I want to check whether the table exists:</p>
  
  <pre><code>#!/bin/sh
  if ![ -e foo.db.1 ]; then
      echo "foo.db.1 does not exist"
      exit 1
  fi
  </code></pre>
  
  <p>then I got an print to say <code>foo.db.1 does not exist</code>. The script seems not working, but if I change the script to check whether the database exist instead of the table exist, it seems work:</p>
  
  <pre><code>#!/bin/sh
  if ![ -e foo.db ]; then
      echo "foo.db does not exist"
      exit 1
  fi
  echo "foo.db does exist"
  </code></pre>
  
  <p>then I get the print to say 'foo.db does exist'</p>
  
  <p>it seems I can check whether the database exist, but cannot check whether the table exist in the database, and I wonder how to do it?</p>