The Simple Shell project is a UNIX command-line interpreter built in C. It is designed to mimic the basic functionality of the standard shell (sh) while demonstrating an in-depth understanding of process creation, execution, and environment manipulation using system calls. The shell was developed as part of the ALX Software Engineering program in collaboration with Ahmed ELSHARKWAY and Wisdom Honest.
- Displays a command prompt and waits for user input.
- Executes commands with and without arguments.
- Supports interactive and non-interactive modes.
- Implements essential built-in commands such as
exitandenv. - Searches for executables in the
PATHenvironment variable. - Proper error handling for command execution failures.
- Efficient memory management with no memory leaks.
To install and run Simple Shell, follow these steps:
- Ubuntu 20.04 LTS (or any Linux distribution)
- GCC compiler
- Git
- Clone the repository on your linux terminal:
git clone https://github.com/wishon1/simple_shell.git
- Navigate to the project directory:
cd simple_shell - Compile the source code:
gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh
Run the shell and type commands interactively:
./hsh
$ ls -l
$ pwd
$ exitExecute commands from a file or another command:
echo "/bin/ls" | ./hsh
cat script.sh | ./hshexit- Exits the shell.env- Prints the current environment variables.
The following system calls are used in Simple Shell:
fork(),execve(),wait(),access()open(),read(),write(),close()malloc(),free(),getline()isatty(),perror(),strtok()
The project follows the Betty coding style and adheres to best practices for readability and maintainability.
- Ahmed ELSHARKWAY
- Wisdom Honest
This project is released under the MIT License.
Special thanks to the ALX Software Engineering program for providing guidance and inspiration for this project.