This project is aimed at creating a simple shell, similar to Bash. This project enhanced my understanding of processes and file descriptors in Unix-like operating systems.
git clone https://github.com/2iaad/Unix-cli 2iaad && cd 2iaad && make && ./minishellUnix-cli is a program that mimics the behavior of a command-line interpreter, accepting and executing commands while offering core shell functionalities. Designed to follow Unix standards, it handles parsing, redirections, pipes, and some built-in commands, providing an educational experience in building a CLI from scratch and understanding how commands are executed behind the scenes.
Unix-cli’s parsing system involves tokenizing input, recognizing built-in and external commands, and handling arguments and operators. This includes:
- Lexical Analysis: Breaking down commands using
libftfunctions (e.g.,ft_split), managing quotes, special characters, and whitespace. - Syntax Parsing: Identifying commands, arguments, and operators like pipes (
|) and redirections (>,<). - Execution Handling: Executing built-in commands or external programs using
execve.
Unix-cli implements pipes and redirections to link commands and manage I/O efficiently. Lets take this example:
- Redirection Management: Sets up file descriptors to redirect input/output as needed, using
dup2to remap them for specific commands. - Pipes: Links multiple commands, passing output from one command as input to the next using file descriptors.
Unix-cli responds to Unix signals (SIGINT, SIGQUIT) to manage command interruption and keep the interface responsive. We can say that it just an action that can be done depending on a signal thrown.
- Command Interruption: Stops currently executing commands without crashing the shell.
- Prompt Control: Clears and redisplays the prompt on specific signals.
Developing and using essential programming concepts like memory management, IPC (inter process communication), formatted output, and file I/O. This project game me programming skills that im pretty sure will help build larger projects.
Thanks for reading sa7bi ;) Enjoy!




