Every now and then, though, I like to do projects simply because I feel like somebody had to do it, so it might as well be me. Writing video games in shell script form definitely qualifies.

In early 2007, a project at work caused me to try to think of complex shell scripts to use in documentation for other script writers. A few of the script ideas I came up with were sufficiently useful, so I wrote them for my employer. A few, however, were so outlandish that I put them aside as fun things to do at home—the sort of project you do entirely for geek cred, with no redeeming societal value. You can guess which bucket this series of shell-script-based video games fell into....

The first working game in the series is Shelltris, a shell-script-based game similar to the popular video game Tetris®. Screen shot below.

screen shot

Apart from a short C program to read a character from standard input in a non-blocking fashion (ten lines, not counting braces and #includes), the/game is written entirely in a Bourne shell script. The game play logic performs its own performance calibration and timing loops, uses ANSI color to draw the blocks, and perform mass array move operations and screen-at-a-time redraws to collapse rows when they are filled.

Download Shelltris

Legal Stuff

Tetris is a registered trademark of V/O Elektronorgtechnika. Shelltris is not in any way associated with the trademark holder, and the trademark holder has not endorsed, supported, or contributed to these scripts in any way.