A very simple Unix shell implementation with job control, command history persistence, and pipeline support.
- Command execution with arguments
- Pipeline support for command chaining
- Job control (background/foreground processes)
- Command history with SQLite persistence
- Directory navigation
- Signal handling (SIGINT, SIGTSTP, SIGCHLD)
cd [path]
: Change directory (supports~
for home directory)bg [job_id]
: Resume stopped job in backgroundfg [job_id]
: Bring background/stopped job to foregroundjobs
: List all background and stopped jobsexit
: Exit the shell
- GCC compiler
- Make build system
- SQLite3 development libraries
- GNU Readline development libraries
- Install dependencies (Ubuntu/Debian):
sudo apt-get install gcc make libsqlite3-dev libreadline-dev
- Clone the repository:
git clone https://github.com/yourusername/shellx.git
cd shellx
- Build the project:
make
- Run the shell:
./shell
shellx/
├── Makefile
├── include/
│ ├── shell.h # Core definitions and structures
│ ├── job_control.h # Job control functionality
│ ├── command.h # Command parsing and execution
│ ├── history.h # Command history management
│ ├── builtins.h # Built-in command handlers
│ └── signals.h # Signal handling
├── src/
│ ├── main.c # Shell entry point
│ ├── job_control.c # Job management implementation
│ ├── command.c # Command processing
│ ├── history.c # History database operations
│ ├── builtins.c # Built-in command implementation
│ └── signals.c # Signal handlers
└── build/ # Compiled objects (created by Makefile)
- Basic command execution:
[/home/user]🐚 ls -l
- Pipeline commands:
[/home/user]🐚 cat file.txt | grep pattern | wc -l
- Job control:
[/home/user]🐚 sleep 100
^Z
[/home/user]🐚 bg
[/home/user]🐚 fg