- Description
- Features
- Requirements
- Installation
- Usage
- File Structure
- Flowchart
- Contributing
- Authors
- License
Simple Shell is a command-line interpreter that provides a user interface to access operating system services. This implementation is written in C and mimics the behavior of the sh shell with specific features and limitations.
- Displays a prompt and waits for the user to type a command
- Handles command lines with arguments
- Handles the PATH to find programs
- Implements built-in commands:
exit
- exits the shellenv
- prints the current environmentcd
- changes directoryhelp
- displays help information
- Handles command separators (
;
) - Supports logical operators (
&&
and||
) - Handles comments (
#
) - Supports variables replacement
- Handles the
$?
variable - Handles the
$$
variable
- Ubuntu 20.04 LTS
- gcc compiler (with flags: -Wall -Werror -Wextra -pedantic -std=gnu89)
git clone https://github.com/Adameelmadani/simple_shell.git
cd simple_shell
gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh
$ ./hsh
($) /bin/ls
hsh main.c shell.c shell.h
($) exit
$
$ echo "/bin/ls" | ./hsh
hsh main.c shell.c shell.h
$
- main.c: Entry point of the program
- shell.h: Header file with function prototypes and structures
- shell.c: Main shell implementation
- builtins.c: Implementation of built-in commands
- parser.c: Command parsing functions
- executor.c: Command execution functions
- helpers.c: Helper functions
- memory.c: Memory management functions
+-------------+ +-----------+ +------------+ +-----------+
| Read Input |---->| Parse |---->| Execute |---->| Display |
| | | Command | | Command | | Result |
+-------------+ +-----------+ +------------+ +-----------+
^ |
| |
+------------------------------------------------------+
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.