Skip to content

A mini Database Management System (DBMS) built using Bash scripting. Supports creating tables and performing CRUD operations via Linux shell commands.

License

Notifications You must be signed in to change notification settings

TarekSaleh99/DBMS-bash-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Perfect 😎 β€” here’s your enhanced and GitHub-optimized README.md version with badges, emoji styling, and aesthetic Markdown formatting. It’s clean, professional, and eye-catching for both GitHub and LinkedIn posts πŸ‘‡


πŸ—„οΈ Bash-Based DBMS Project

Made with Bash License: MIT Linux Compatible Educational Project


🧩 Overview

This project is a mini Database Management System (DBMS) built entirely with pure Bash scripting β€” no SQL engines, no databases, just shell logic. It simulates core DBMS functionality like creating databases, tables, inserting, selecting, updating, and deleting rows β€” all stored as simple text files in your filesystem.

πŸ’‘ Think of it as SQL without SQL β€” powered only by Linux commands.


πŸš€ Features

🧠 Database-Level Operations

  • πŸ“ Create Database – Initialize a new database.
  • πŸ“š List Databases – Display all existing databases.
  • πŸ”— Connect To Database – Access and manage tables interactively.
  • πŸ—‘οΈ Drop Database – Permanently remove a database.

πŸ“‹ Table-Level Operations

  • πŸ—οΈ Create Table – Define columns, datatypes (int / string), and a primary key.
  • πŸ“„ List Tables – Show all tables inside a database.
  • 🧨 Drop Table – Remove a specific table.

🧱 Data-Level Operations

  • βž• Insert Row – Add a new row with data-type and primary key validation.
  • πŸ” Select Rows – View all rows in a formatted table output.
  • ❌ Delete Row – Delete specific rows by their index number.
  • ✏️ Update Row – Modify values in a specific column with type checking.

βš™οΈ How It Works

πŸ—‚οΈ Every database is a directory inside the Databases/ folder. πŸ“„ Each table is a text file containing its schema and rows.

Example table file:

Columns:id,name,age Types:int,string,int PK:id 1,John,25 2,Jane,30 

Operations like insert, update, and delete are performed using awk, sed, and other core Bash tools to ensure proper schema enforcement and data integrity.


🧱 Project Structure

. β”œβ”€β”€ dbms.sh # Main entry point (menu system) β”œβ”€β”€ lib/ β”‚ β”œβ”€β”€ db_operations.sh # Database operations (create, list, drop, connect) β”‚ └── table_operations.sh# Table operations (CRUD for data) └── Databases/ # Auto-created folder for all user databases 

🧰 Prerequisites

Before running, make sure you have:

  • 🐧 Linux / macOS / WSL on Windows
  • πŸ’‘ Bash v4+
  • 🧱 Utilities: awk, sed, wc, nl, mkdir, rm

🧠 Run bash --version to check your version.


▢️ Getting Started

1️⃣ Clone the Repository

git clone https://github.com/yourusername/dbms-bash.git cd dbms-bash

2️⃣ Give Execute Permission

chmod +x dbms.sh

3️⃣ Run the Program

./dbms.sh

4️⃣ Use the Interactive Menus

Example:

1) Create Database 2) List Database 3) Connect To Database 4) Drop Database 5) Exit 

🧩 Example Usage

Creating and managing data inside your own DBMS:

Enter your choice: 1) Create Database #? 1 Enter database name: mydb Database 'mydb' created. #? 3 Enter database name to connect: mydb Connected to database 'mydb'. # Inside table menu: 1) Create Table 2) Insert Row 3) Select Rows 

βœ… Example Select Rows Output:

Row | id | name | age ------------------------------------------------ 1 | 1 | John | 25 2 | 2 | Jane | 30 ------------------------------------------------ 

πŸ’‘ Key Bash Concepts Used

Concept Description
🧠 awk Print and format tabular data
βœ‚οΈ sed Inline editing for update operations
πŸ”  IFS Parse comma-separated schema
🧩 Arrays Store column names and datatypes
🧱 Regex Validate integer and string data
πŸ” select Interactive CLI menus
🧼 mktemp Safe atomic updates using temp files

🎯 Learning Outcomes

Through this project, you’ll learn:

  • How databases work at the filesystem level.
  • How to implement CRUD operations with shell scripting.
  • Real-world use of awk, sed, regex, and array manipulation.
  • The importance of validation, schemas, and primary keys.

🧠 A perfect learning project for students exploring DevOps, Linux, or backend fundamentals.


πŸͺͺ License

This project is licensed under the MIT License. You’re free to use, modify, and distribute it for learning or demo purposes.

MIT License


πŸ™Œ Acknowledgments

Built with ❀️ using pure Bash to explore how DBMS concepts work under the hood β€” from schemas and records to data integrity and CRUD logic.

🌟 β€œUnderstanding how data is stored and managed is the first step to mastering backend systems.”

About

A mini Database Management System (DBMS) built using Bash scripting. Supports creating tables and performing CRUD operations via Linux shell commands.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages