This project implements a simple custom shell (VShell) written in C and executed inside a Vagrant-based Linux virtual machine.
The shell supports running standard Unix commands using fork() and execvp(), and implements assignment-specific rules for input and output redirection.
Input redirection is performed using the {filename syntax, while output redirection uses the filename} syntax. Both types of redirection must appear at the end of the command, as defined in the assignment specification.
The shell also provides error handling for invalid redirection usage, missing or inaccessible files, and failed command execution.
VShell operates in a REPL loop displaying the $$ prompt, executes one command per iteration, waits for child process completion, and terminates cleanly upon receiving EOF (Ctrl+D).
- The shell accepts one command per iteration.
- Commands are parsed into arguments using whitespace separation.
- If redirection is present, it must appear at the end of the command only.
{filenamesets the input source for the command (file must exist).filename}redirects output to a file (created or overwritten).- Any syntax violation results in an error message and the command is not executed.
- The shell waits for all child processes before prompting again.
- End-of-file (Ctrl+D) exits the shell after printing a newline.
bash git clone cd
vagrant up (Start the Vagrant VM) vagrant ssh
gcc os2.c -o c2.os
./c2.os