What database should I use?
All I can offer you at this point are my deepest sympathies! 

Doesn't the person/company who/which is getting you to write a tool under this mind-boggling constraint realise that you'll have to do far more work for a far lesser return than if you used (as you say) Python or Perl or even Brainfuck :-).

Anyway, what you wrote rang a very old bell in my memory cells - I remembered having read about a database system written in shell which I thought might have been interesting for, say, a student project (sort of like those C obfuscation competitions that challenge people to be clever without actually doing anything useful).

I visted Christopher Browne's linux databases site and found what I was looking for here (the kshSQL DBMS link). I was unable to find the source code for that one, but it is based on another programming effort, shql, a DBMS written in bash - it's github, so you have the source code.

The only bright spot on the horizon for you IMHO, is that it was written by Bruce Momjian who is a major player in the PostgreSQL world and knows a thing or two about databases. I've never used it, but there's just a chance that you might be able to do something with this. Good luck, you're going to need it! :-)