This repository contains my implementations of various shell programs. These programs mimic the functionality of a Unix shell, allowing users to execute commands, manage processes, and navigate the filesystem. The projects included here serve as practical examples of how shells work and the underlying mechanisms involved.
- Command Execution: Handling user inputs to execute commands.
- Process Management: Managing foreground and background processes.
- I/O Redirection: Redirecting input and output for commands.
- Piping: Connecting the output of one command to the input of another.
- Built-in Commands: Implementing essential shell commands like
cd,exit, andhelp.
Shell_program/
│
├── simple_shell.c # Basic shell implementation with command execution
├── process_management.c # Managing foreground and background processes
├── io_redirection.c # Implementing I/O redirection in the shell
├── piping.c # Implementing piping between commands
└── built_in_commands.c # Implementation of built-in shell commands
-
Clone the repository:
git clone https://github.com/josethomas45/Shell_program.git
-
Compile the C programs: You can compile the shell programs using GCC:
gcc -o shell_program simple_shell.c
-
Run the Shell: Execute the compiled shell program:
./shell_program
-
Command Execution:
- The shell reads user input, parses commands, and executes them using
exec()system calls.
- The shell reads user input, parses commands, and executes them using
-
Process Management:
- Allows execution of processes in the foreground and background using
fork()andwait().
- Allows execution of processes in the foreground and background using
-
I/O Redirection:
- Supports input (
<) and output (>) redirection for executing commands with file input and output.
- Supports input (
-
Piping:
- Implemented the ability to pipe commands together using
|, allowing for complex command execution sequences.
- Implemented the ability to pipe commands together using
-
Built-in Commands:
- Implemented essential built-in commands such as
cdfor changing directories andexitfor terminating the shell.
- Implemented essential built-in commands such as
- C Compiler: Ensure you have a C compiler like GCC installed.
- Linux/Unix Environment: Recommended for running and testing the shell programs.
Contributions are welcome! To contribute to this repository:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes and commit them (
git commit -m 'Add new feature'). - Push the changes to your branch (
git push origin feature-branch). - Create a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.
For any questions, feedback, or suggestions, feel free to reach out:
Jose Thomas
GitHub Profile