MBsh is a simple shell implemented in C, designed to execute external programs and parse command arguments. This project focuses on understanding the basics of shell functionality, with a minimalist approach to error handling.
- Project Overview
- Features
- Installation
- Usage
- How It Works
- Known Issues and Limitations
- Future Improvements
- Contributing
MBsh provides a basic shell environment that executes external commands, similar to /bin/sh
. It does not currently support internal commands like cd
or exit
, keeping the focus on external program execution and argument parsing.
- Program Execution: Runs external programs (e.g.,
/bin/ls
,/bin/echo
) with specified arguments. - Argument Parsing: Parses and passes command-line arguments to the programs.
- Minimal Error Handling: Basic error handling to manage invalid commands or missing arguments.
-
Clone the repository:
git clone https://github.com/your-username/MBsh.git
-
Navigate to the project directory:
cd MBsh
-
Compile the code:
make compile
To start MBsh, run:
make run
or
./build/MBsh.out
- MBsh reads user input and splits it into the program name and arguments.
- Basic error checks are applied, such as handling empty input.
- MBsh uses
fork()
to create a new process for executing the program. - In the child process,
execvp()
is called to run the specified program with arguments.
- Minimal error handling is in place for unrecognized commands or argument errors.
- MBsh continues prompting for new commands unless terminated.
- No Internal Commands: Commands like
cd
andexit
are not supported as internal shell commands. - Limited Error Feedback: Error handling is minimal, providing basic feedback on invalid commands.
- No Redirection or Piping: Features like input/output redirection and piping are not implemented.
- Add Internal Commands: Implement internal commands, such as
cd
andexit
. - Enhanced Error Handling: Provide more informative error messages and handle additional edge cases.
- Support for Redirection and Piping: Enable support for
>
,<
, and|
operators. - Job Control: Allow commands to be run in the background with
&
.