Skip to content

Navigation Menu

Sign in
Sign up

Latest commit

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

🐚 UNIX Shell Project

A custom UNIX shell implementation built from scratch in C as part of BRACU CSE321 (Operating Systems) Lab.

Preview


πŸ“‹ Table of Contents


✨ Features

Feature Description
Command Prompt Interactive shell prompt (UNIX Shell >) for user input
Command Execution Parse and execute system commands using fork() and exec()
Multiple Commands Execute multiple commands inline using semicolon (;) separator
Logical AND Sequential command execution with && (stops on failure)
Input Redirection Redirect input from files using < operator
Output Redirection Redirect output to files using > (overwrite) or >> (append)
Piping Chain commands with | for unlimited pipe operations
Signal Handling Graceful CTRL+C handling without shell termination
Command History Maintains history of last 20 executed commands

πŸš€ Getting Started

Prerequisites

  • GCC compiler
  • Linux/Unix environment (or WSL on Windows)

Compilation

gcc -o shell "UNIX Shell.c"

Running the Shell

./shell

Or use the provided script:

./run-shell

πŸ’» Usage

Basic Commands

UNIX Shell > ls -la
UNIX Shell > pwd
UNIX Shell > echo "Hello World"

Multiple Commands with Semicolon

UNIX Shell > ls ; pwd ; whoami

Sequential Execution with AND

UNIX Shell > mkdir test && cd test && touch file.txt

Input/Output Redirection

UNIX Shell > cat < input.txt
UNIX Shell > ls -la > output.txt
UNIX Shell > echo "append this" >> output.txt

Piping Commands

UNIX Shell > ls -la | grep ".c"
UNIX Shell > cat file.txt | sort | uniq
UNIX Shell > ps aux | grep bash | head -5

πŸ“Œ Built-in Commands

Command Description
cd [dir] Change directory (defaults to $HOME if no argument)
history Display command history (last 20 commands)
ABOUT Show program details and contributor information
EXIT Terminate the shell gracefully

πŸ‘₯ Team Members

Name Student ID GitHub
Al Saihan Tajvi 23301219 β€”
Farhan Zarif 23301692 @Faustus-Faber
Sadik Mina Dweep 22101837 @sadikmina

πŸ›  Contributions

Al Saihan Tajvi

  • βœ… Command prompt display and user input handling
  • βœ… Command parsing and execution using fork() and exec() system calls
  • βœ… Multiple inline commands with semicolon (;) separator
  • βœ… Sequential command execution with logical AND (&&)

Farhan Zarif

  • βœ… Input redirection (<) using dup() and dup2()
  • βœ… Output redirection (>, >>) using dup() and dup2()
  • βœ… Command piping (|) supporting unlimited pipes

Sadik Mina Dweep

  • βœ… Signal handling (CTRL+C) using signal() and sigaction()
  • βœ… Command history maintenance and display

πŸ“„ License

This project was developed for educational purposes as part of the CSE321 Operating Systems course at BRAC University.


It was an incredible experience collaborating on this project! πŸš€

About

UNIX Shell Project | BRACU CSE321 Lab

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /