#!/bin/bash openDatabase() { rm -f "$tempdir"/sqlite.{in,out} mkfifo "$tempdir"/sqlite.{in,out} sqlite3 -bail "$database" \ < "$tempdir/sqlite.in" \ > "$tempdir/sqlite.out" & exec 3> "$tempdir"/sqlite.in exec 4< "$tempdir"/sqlite.out if (( debug > 2 )) then exec 5>&3 exec 3> >(tee -a $tempdir/debug.log >&5) fi cat $schema >&3 echo '.separator ::AtOM:SQL:Sep::' >&3 echo 'PRAGMA foreign_keys = ON;' >&3 checkDatabaseVersion }