Improve your shell skills by writing a game

I spend a lot of time in shell. Like really a huge amount of time. I use my editor through a shell. I test my code locally in the shell. I could safely assume that 70 procent of my productive time is spent on various shell activities and rest is probably spent in the browser.

Yet, I known very little about writing a shell script. I didn’t really even known the difference between sh, bash, dash, zsh and csh. I always planned to learn it, but I have postponed it endlessly. There was always something cooler to learn, something more interesting to read about.

But one day I have stumbled upon a Github repository that implemented a breakout like game in pure shell script. It was a strange idea. Shell is probably not the best language for game development. It is not even a worthy candidate. Yet, the process of writing a game could teach me a lot about loops, conditions, functions and the rest of the basics in any language. So I decided to make my own version of that game. And it was valuable experience. In the next the post I will try to share some of the things I have learned about shell scripting, and hopefully encourage you to also make a game in bash, dash, zsh … or whatever.

shot.png

Here is the link to the full source of the game named squa.sh.

See you in the next post!

 
5
Kudos
 
5
Kudos

Now read this

Alias method – CoffeeScript

In programming we like to reuse stuff. Data, variables, classes and even whole systems. We have a rule of thumb to only write code if it can not be found somewhere else. But sometimes the same thing can have a different meaning in a... Continue →