stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

Custom C-Shell

  • 3 Devlogs
  • 18 Total hours

A custom POSIX-compliant Unix shell written entirely in C from scratch. It features a custom lexical analyzer and parser to enforce strict grammar rules, alongside a robust execution engine that handles external $PATH binaries, I/O file redirection (<, >, >>), and complex multi-command piping (|). It also includes natively implemented built-in commands like hop (a persistent directory jumper with a Zoxide-style time-decay frecency algorithm), reveal (a recursive directory scanner), and peek (a memory-efficient file viewer).

Open comments for this post

6h 10m 49s logged

Logged 6 hours today wrapping up my C-Shell mid-submission, focusing on fixing a major architecture bug, optimizing features, and thoroughly documenting the codebase. First, I added a stale path cleanup mechanism to my Zoxide-style hop command, ensuring that deleted directories or those with a frecency rank below 0.5 are automatically purged from the hidden database. Next, I tackled a tricky OS trap involving multiple output redirections: because execv() replaces the entire process image, it was obliterating my post-execution file-writing logic. I fixed this by building a custom tee-style pipeline that forks a second proxy “writer” child to safely read the command’s output via a pipe and distribute it to all files simultaneously. Finally, I went through all my files to rigorously comment the complex dup2 file descriptor routing and backward file-chunking logic.

0
0
7
Ship #1 💀 Cursed

After 11+ hours of wrestling with C, pointers, and POSIX syscalls, I am shipping my custom Unix shell!

What started as a custom lexer and parser (built entirely from scratch without tools like Yacc) has grown into a fully functional execution environment.

Highlights:

Full Execution Engine: Handles complex pipelines (cmd1 | cmd2 | cmd3) and I/O redirection (<, >, >>) using precise file descriptor management (dup2, pipe, fork).

Zoxide-style Navigation: My hop built-in tracks every directory you visit and uses a time-decaying frecency algorithm so you can jump anywhere using just a substring.

Memory Optimization: Built-ins like peek read files backward chunk-by-chunk using lseek to avoid loading massive files into memory.

Building a shell from the ground up completely changed how I look at the terminal. Source code is linked below, as well as a short demo video!

  • 2 devlogs
  • 12h
  • 12.85x multiplier
  • 75 Stardust
Try project → See source code →
Open comments for this post

3h 18m 19s logged

Spent the last 3 hours building the core execution engine for my C-Shell. I implemented external command execution by scanning $PATH and using the fork() and execv() syscalls. The biggest challenge was getting I/O redirection and piping to work correctly. I used dup2() to hijack standard input/output and route them through anonymous temporary files (tmpfile()) to handle multiple file redirections at once.I also ran into a brutal segmentation fault because my built-in commands weren’t expecting redirection operator tokens. I ended up doing a massive architectural refactor to move the entire file descriptor routing to the parent shell level. Now, whether it’s an external binary like ls or my custom peek built-in, they both seamlessly read and write through pipes and files!

0
0
8
Open comments for this post

8h 25m 50s logged

I spent the last 8+ hours building a custom POSIX-compliant C shell from scratch. I built a custom lexer and parser to handle right-linear grammar, quoting, and escaping without using standard parsing tools like Lex/Yacc. I also implemented several complex built-in commands natively without relying on exec system calls, including a custom directory jumper (hop) with a time-decaying frecency algorithm (similar to Zoxide) that persists across sessions, and a custom cat-like tool (peek) that uses lseek to read files in reverse chunk-by-chunk to save memory.

0
0
8

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…