Peng Yu wrote:
> Is there a better way to just return an exit status of 0 for
> a sqlite3 DB file and 1 otherwise?

Extract the magic header string from a known DB file:

  dd bs=16 count=1 < some.db > sqlite3-signature

Then you can compare it against the beginning of the file:

  cmp --bytes=16 sqlite3-signature /tmp/tmp.erZ5aS6PUX.sqa > /dev/null
  [ $? = 0 ] && echo SQLite DB


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to