Skip to content

Athanasioust/Custom-Unix-Shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

hy345sh — Custom Unix Shell

A lightweight Unix shell written in C, built from scratch as a systems programming exercise. It supports command execution, I/O redirection, sequential commands separated by semicolons, and single-pipe piping between two commands.


Features

  • Interactive prompt showing the current working directory
  • Command execution via execvp with full argument support
  • Built-in chdir for directory navigation
  • Built-in quit to exit the shell
  • I/O redirection< for stdin, > for stdout
  • Sequential commands separated by ;
  • Single pipe (|) between two commands

Build

gcc -Wall -O2 -o hy345sh hy345sh.c

Run

./hy345sh

You will be greeted with a prompt like:

<4581>-hy345sh@sfyrixtras:/home/user $

Usage Examples

Basic command

<4581>-hy345sh@sfyrixtras:~ $ ls -la

Output redirection

<4581>-hy345sh@sfyrixtras:~ $ ls > output.txt

Input redirection

<4581>-hy345sh@sfyrixtras:~ $ sort < input.txt

Sequential commands

<4581>-hy345sh@sfyrixtras:~ $ ls ; pwd ; echo hello

Pipe

<4581>-hy345sh@sfyrixtras:~ $ ls | grep .c

Change directory

<4581>-hy345sh@sfyrixtras:~ $ chdir /tmp

Exit

<4581>-hy345sh@sfyrixtras:~ $ quit

Limitations

  • Pipes support only a single | (two-command pipeline)
  • No background process support (&)
  • No environment variable expansion
  • No command history

File Structure

hy345sh/
└── hy345sh.c       # Full shell implementation

Author

Stylianos Athanasiou — CSD4581

About

A lightweight Unix shell written in C supporting command execution, I/O redirection, sequential commands (;), and single-pipe piping

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors