Skip to main content

C'est la Z

Shell Games - an introduction

A few weeks ago, I noticed this Twitter conversation between Alfred Thompson and Steve Keinath

I briefly considered proposing a session for the conference but it was just a day or two before the deadline, I don’t know if I’m going to be able to attend the conference, and besides, who said anything I proposed would be accepted.

Still, I liked the idea - I’ve been an educator for 23 years, a Linux user for most of that time and an Unix user for longer. I’m a firm believer in operating system as toolkit and so I think I’ll take Steve and Alfred’s suggestion and try to put together a series of posts on using Linux from a CS educators point of view.

So, before we begin - a little background.

I can proudly say that I’ve been Windows free since about 2000. That’s when I decided to wipe the lat traces of Microsoft from my hard drives. Prior to that I just booted up MS-DOS or Windows to play games or to use a Excel or Word.

Since the early days of Linux - back before Slackware, I dual booted. Before Linux, I dialed into public Unix systems such as Panix or The Big Electric Cat. At home, I tried to make MS-DOS as Unix like as I could. I ran the MKS Toolkti, and used my own shell (a project every young programmer should attempt).

Why am I posting this now? It’s a new semester and I find myself, as usual, leveraging the Linux shell. It was time to set up a mailing list for the class.

I’m able to go to our school’s data system and grab a tab delimited file that looks something like this:

It’s tab delimited but I scrambled the letters so as to not reveal any student info.

Oh, how did I do that scrambling? Easy. First, I combined some basic utilities to make a random permutation of the upper and lower case letters and stored them in a shell variable. Don’t worry, I’ll explain these commands in upcoming posts:

Then I used tr (translate) to exchange the real letters for the matching letter in the random permutation:

So back to the real work. I needed to isolate the students email addresses. The process:

So, I typed:

grep filters out lines that have MKS22X in them and sed replaces the tabs (\t) with commas and cut pulls out the email addresses. It’s all stored in a file named emails.

Now, I just have to import these into my maillist software (mailman).

So, that’s it, easy peasy.

I’ll be away for most of this week at the Tapia conference and then I’ll be playing catch up, but I’m hoping to do a series of posts talking about my Linux toolset and how I use it.

I hope you all find it interesting and maybe even useful.

comments powered by Disqus