Disclaimer: This project is a work in progress and is not yet complete. It is still in early parts of development. Contributions, suggestions, and feedback are welcome!
Welcome to C-Shell, a simple shell implementation in C! This project is a learning exercise aimed at understanding how shells work under the hood. The goal is to create a functional shell with most of the basic capabilities of bash, excluding advanced features like piping and custom prompts (for now).
- Basic command execution (e.g.,
ls,cd,pwd) - Built-in commands (e.g.,
exit,help) - Command history (up/down arrow support)
- Input/output redirection (e.g.,
>,<) - Background process execution (e.g.,
&) - Environment variable support (e.g.,
$HOME) - Tab completion (stretch goal)
To build and run the C-Shell locally, follow these steps:
- A C compiler (e.g.,
gcc) - A Unix-like operating system (Linux or macOS recommended)
-
Clone the repository:
git clone https://github.com/Brollemolle/c-shell.git cd c-shell -
Compile the shell:
gcc -o cshell src/main.c
-
Run the shell:
./cshell
-
Test the shell:
- Try running basic commands like
ls,cd, andpwd. - Use
exitto quit the shell.
- Try running basic commands like
This project is a great way to:
- Learn how shells work internally.
- Understand process management in Unix-like systems.
- Practice C programming, especially working with system calls like
fork(),execvp(), andwait(). - Gain experience in building a real-world tool from scratch.
- System Calls: Using
fork(),execvp(),wait(), andchdir(). - String Parsing: Tokenizing user input into commands and arguments.
- Process Management: Handling foreground and background processes.
- Error Handling: Gracefully handling errors and edge cases.
This project is primarily for learning purposes, but if you’d like to contribute, feel free to open an issue or submit a pull request! Here are some areas where contributions would be welcome:
- Adding new features (e.g., piping, tab completion).
- Improving error handling.
- Writing test cases.
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or feedback, feel free to reach out.