All projects

Archive · 2023

sh

A simple Unix command-line interpreter — path lookup, exit, and builtins — written in C with Sandra.

Co-author with Sandra

  • C
  • Unix

Problem

Understand process control, parsing, and the Unix environment by building a shell instead of only using one.

What I built

  • Implemented a GNU89 C interpreter: parse input, resolve PATH, execve, and handle builtins (cd, env, setenv, unsetenv, exit).
  • Compiled with gcc -Wall -Werror -Wextra -pedantic -std=gnu89 on Ubuntu 20.04.
  • Collaborated with Sandra (github.com/sandra113).

Outcomes

  • A working `hsh` binary that runs commands like a small Unix shell.
  • Systems fundamentals that sit next to the later C++ Companio music core.

A small Unix shell

sh is a C command-line interpreter I built in 2023 with Sandra.

It parses a line, resolves PATH, calls execve, and handles builtins (cd, env, setenv, unsetenv, exit). We compiled with gcc -Wall -Werror -Wextra -pedantic -std=gnu89 on Ubuntu 20.04.

This is homework in the best sense: you do not understand processes until you have spawned them. It sits next to the later C++ Companio core as the earlier time I cared about a tight, boring systems loop.

Sandra is a collaborator, not a mention in passing — the repo is ours.