Skip to content

JacobZhang0/shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Tiny Shell (wip)

A small C program that builds shell-style command arguments from user input. Written on macOS using Clang and LLDB.

This project currently implements command parsing, basic command execution, signal handling, and core built-ins.

What it does right now

  • Reads input using fgets()
  • Removes the trailing newline
  • Tokenizes the command line using strtok()
  • Constructs an argv-style array char *my_argv[]
  • Executes commands by spawning child processes with fork() and execvp()
  • Supports built-in commands (cd and exit)

Example

Input: ls -l /tmp Output: Runs the ls command and prints directory contents.

Usage

To compile and run the project locally on macOS:

# Compile with Clang
clang -Wall -Wextra -g sh.c -o sh

# Run the program
./sh

Next Steps

  • Process execution with fork() and execvp()
  • Built-in commands (cd, exit)
  • Pipelines using pipe()
  • I/O redirection using dup2()
  • Signal handling (SIGINT)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages