Sales:  800-573-7846 or Live Chat

The ServInt Source

My Son’s First Linux Command

3038629479_cdf1017a4e_bMy son is five years old and a digital native. For the last year or so he’s been saying that he wants to develop video games when he grows up. I’ve acknowledged his desire, telling him that he can develop video games, but that he’d need to learn how to write code and work hard. When he recently brought up his plan again I finally said, “Okay, lets do it.”

We sat down and talked about what he wanted his game to do. His first idea was a Minecraft type game with dinosaurs, I told him that was a good end goal, but that we needed to start smaller, something simple. I asked him what he wanted the goal of his game to be about, he said slaying a dragon. Then I asked him how he wanted the game to start, and he chose waking up in a cave. We then began designing our text-based adventure.

I used this opportunity to teach him the echo command. Echo is the simplest of commands, returning whatever string of text or variables is typed into the command. It’s also a great command to use to learn your first script.

He really enjoyed echo because of the instantaneous feedback. We started with “Hello World!” which seems traditional when learning any type of coding. We edited the command string so that it said hello to him and then I showed him how you can include it in a script and have inputs to it. We started with:

hello.sh
#!/bin/bash
echo “Hello $1!”

He started picking words like underpants or fart so that the command sh hello.sh fart would say “Hello fart!” and then laugh and laugh. I then showed him that you could have multiple inputs and that you could call a script from within a script. After playing around with that for awhile we started writing the game.

“You wake up in a deep cave. There are two passages. Do you want to go [up] towards the light or [down] towards the dark?”

My son was on his way…

Photo by Benjamin White

About Bill Brooks

Bill Brooks is an Escalated technician and the Continuing Education Facilitator for ServInt's Managed Services Team. He is a life-long tech enthusiast and enjoys music, video games and hockey on the side.


The ServInt Source | Web Hosting Blog