Jesse Storimer's Blog Archives tagged Implementing a Shell

A Unix Shell in Ruby - Part 4: Pipes - March 18, 2012

  Previously, in this series, we looked at interacting with environment variables (like PATH). In this article we'll investigate a peculiarity. It will reveal an impostor and eventually lead to implementing shell pipelines. First, the Peculiarity Observe these interactions with the shirt shell: $ ./shirt $ ls LICENSE README shirt $ ls | grep README README $ ls > output.txt $ cat ...
Read more

A Unix Shell in Ruby - Part 3: A Login Shell and the PATH - March 10, 2012

Previously, in this series, we saw how to implement some shell built-ins that are really necessary for the shell to function. This time, we'll make sure our shell can be used as a login shell and see how to interact with environment variables. First, A Word of Warning In this article I'm going to set up shirt as the default ...
Read more

A Unix Shell in Ruby - Part 2: Builtins - February 21, 2012

Welcome to the second article in this series. Last time we implemented a verrrry basic shell that could just run most basic commands. This time around we're going to look at how it's broken and how we can fix it. First up, we'll need a few builtins. A Note on Launching Last time I explained the semantics of exec: a call ...
Read more

A Unix Shell in Ruby - February 16, 2012

This is the first article in a series where I'll implement a Unix shell in pure Ruby code. Why a shell? A shell is the quintessential example of a Unix program. It hits all of the interesting points that a Unix system is capable of. It has to read input from STDIN, spawn processes requested from users, send signals to ...
Read more