Skip to content

Instantly share code, notes, and snippets.

@psema4
Created November 14, 2013 17:02
Show Gist options
  • Save psema4/7470381 to your computer and use it in GitHub Desktop.
Save psema4/7470381 to your computer and use it in GitHub Desktop.
A simple utility to read all .sql files in the current directory, create an in-memory database from them and start a sqlite3 shell
#!/usr/bin/env bash
# A simple utility to read all .sql files in the current directory, create an
# in-memory database from them and start a sqlite3 shell
if [ -f mini.db ]; then
echo "found existing database, removing"
rm mini.db;
fi
cat ./*.sql | sqlite3 mini.db -init - && sqlite3 mini.db
# cleanup
if [ -f mini.db ]; then
rm mini.db;
fi
echo "done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment