A relational database with no database engine — just Bash, a directory tree and a great deal of awk.
Databases are directories under DBMS/, tables are files inside them, and each table is shadowed by a hidden metadata file — .customers beside customers — holding one line per column: name, type and key flag, pipe-separated. Splitting the schema out from the rows is what makes the type check on insert and the primary-key scan possible at all, and it is a recognisable ancestor of how real engines keep a catalogue separate from the heap.
Everything a real DBMS gives you for nothing had to be written by hand. Identifiers are validated against ^[a-zA-Z]+$ before a directory is created. Insert reads the column list out of the metadata file and prompts per column, checking each value against its declared type. Update and delete resolve a column name to its field number by scanning the header with awk, then rewrite the entire file — because there is no seeking to a row in a text file, and no way to change one in place.
The menu-driven CLI drops into a per-database context when you connect, which is as close as it gets to a session.
An academic exercise, but the productive kind: it is hard to take an index for granted after writing the linear scan it replaces.
A small command-line "database management system" written entirely in Bash. Databases live on disk as directories and tables as files, manipulated through a menu-driven CLI.
Features#
- Create / list / connect to / drop databases
- Create tables with column names, types and a primary key
- Insert, select, update and delete rows
- Input validation (table/column name patterns, type checks, PK uniqueness)
- Drops down into a per-database menu when you "connect"
Tech#
- Bash (POSIX-ish, uses
[[ ]], arrays and regex)
Run it locally#
git clone https://github.com/Vette1123/Bash-DBMS-Project.git
cd Bash-DBMS-Project
chmod +x projectfinal.sh
./projectfinal.shState is stored under a DBMS/ folder created next to the script. Each database is a subdirectory; each table is a plain file inside it.
Notes#
This was an academic exercise to model a tiny relational system without any actual database engine — useful for learning Bash control flow, file I/O and regex validation.