The Simple Shell project is an implementation of a basic command-line interpreter. This shell replicates the behavior of the standard Unix shell, providing an interface for users to execute commands and manage processes.
- Command execution: Executes commands with arguments.
- Built-in commands: Supports built-in commands like
cd,exit, andenv. - Path handling: Searches for executable files in the directories listed in the
PATHenvironment variable. - Error handling: Displays appropriate error messages for invalid commands or arguments.
- Interactive and non-interactive modes: Operates in both interactive mode (user input) and non-interactive mode (script execution).
- A Unix-like operating system (Linux, macOS)
- GCC compiler
-
Clone the repository:git clone https://github.com/petrushimself/simple_shell.git
-
Navigate to the project directory:cd simple_shell
-
Compile the source files:gcc -Wall -Werror -Wextra -pedantic *.c -o hsh
-
Interactive mode:
./hsh
Type commands and press Enter to execute.
-
Non-interactive mode:
echo "command" | ./hsh
or
./hsh < script
cd [directory]: Change the current directory.exit [status]: Exit the shell with a given status.env: Print the environment variables.
$ ./hsh $ ls -l total 8 -rw-r--r-- 1 user user 0 Jul 31 09:47 file1 -rw-r--r-- 1 user user 0 Jul 31 09:47 file2 $ cd .. $ exit
- Petrus Tlhomedi - petrushimself
This project is licensed under the MIT License - see the LICENSE file for details.
- ALX Africa for the project guidelines and resources.
- The creators of the original Unix shell for inspiration.