Zoro Shell is a simple POSIX shell written in C language.
Note: This shell won't work on windows, since POSIX.
Download the binaries I released, the one compatible for your system
OR
-
Compile the shell:
gcc src/main.c -o zoro
-
Run it:
./zoro
-
Type a command(help) at the
>prompt and press Enter. -
Use
exitto leave the shell.
- Interactive command prompt using
>. - Reads user input line by line.
- Splits commands and arguments by whitespace.
- Runs external programs available in your system path.
- Uses
fork()to create a child process for commands. - Uses
execvp()to execute external commands. - Waits for child processes to finish before showing the next prompt.
- Includes basic built-in commands.
- Handles end-of-file input cleanly.
- Reports errors for failed reads, forks, and command execution.
cd <path>: Changes the current working directory.help: Shows shell usage information and available built-ins.exit: Stops the shell.
Zoro Shell runs a loop that prints a prompt, reads input, parses it into arguments, and decides whether the command is built in or external.
Built-in commands are handled directly by the shell process. This is required
for commands like cd, because changing directories must affect the running
shell itself.
For external commands, the shell creates a child process with fork(). The
child process calls execvp() to replace itself with the requested program,
while the parent process waits until the child exits or is signaled.
Because I am a One Piece fanboy ;)
>help
>cd src
>ls
>exit- Commands are separated by spaces, tabs, and newlines.
- Quoting, pipes, redirects, and environment variable expansion are not currently implemented.
- This project is intended as a small educational shell implementation.