#!/bin/bash currentdbversion=1 checkDatabaseVersion() { local dbversion if dbversion=$(Select atom version <<<"1 = 1") then if (( dbversion == currentdbversion )) then return 0 elif (( dbversion < currentversion )) then until (( dbversion == currentversion )) do upgradedatabase_${dbversion}_$((dbversion+1)) dbversion=$(Select atom version <<<"1 = 1") done else echo "Database schema version $dbversion is higher than that of this version of AtOM ($currentdbversion). Bailing out." >&2 exit 1 fi else Insert atom 1 <<<"version $currentdbversion" fi }