Skip to content

glam2310/shell-os2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

VShell – Simple Custom Shell (OS2 Assignment)

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).

Behavior

  • 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.
  • {filename sets 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.

Installation & Setup

1. Clone the repository

bash git clone cd

2. Start the Vagrant VM

vagrant up (Start the Vagrant VM) vagrant ssh

3. Navigate to the project directory inside the VM

4. Compile

gcc os2.c -o c2.os

5.Run

./c2.os

About

A custom shell implemented in C, built as part of an Operating Systems project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages