Return to lecture notes index
August 25, 2010(Lecture 2)

The Shell

We did a quick whirlwind tour of the UNIX shell interface. For those who are unfamiliar, you'll find a very good introduction as part of the Linux Documentation Project (LDP) here:

Introduction to Linux: A Hands-On Guide (Garrels)

In particular, chapters 2 and 3 are mostly stuff you should know and with which you should beocme comfortable:

The following documentation, which has been tailored to our enviornment, is less complete, but might be more applicable and get you going faster:

You might also find this documentation about AFS helpful:

A Spectrum of languages

Thus far, mosty of you have only programmed in high-level compiled languages, languages like C, C++, and Java. Compiled languages are designed so that they are friendly to humans -- but so that the fundamental language operations reflect those available in hardware. Code that has a lot of complexity is reserved for libraries -- not first class language features. Compiled languages are great for highly customized, highly efficient code. They are great for production software, where every detail must be neat and/or where the code must meet performance criteria, especially with large amounts of data. In this class, we'll study The C Language.

At the other end of the spectrum are scripting languages. Here we save the effort of the compile-run process, by skipping the compile step. Instead, the script is just interpreted. And, we build with much larger building blocks -- we tie whole programs together. The downside is that linking large programs tends to involve a lot of overhead, so the result is slower. it is also the case that the end result sometimes feels a bit function-over-form. So, we tend to use scripting languages for one-off problems, for probelms with modest amounts of data, and especially for very complicated problems, that can be soved quickly with large building blocks, but that have modest amounts of data. In this class, we'll study scripting for the UNIX shell.

In between are interpreted languages, such as Perl, PHP, and Python. In syntax, they tend to look much like compiled languages. But, like shell scripts, they are interpreted rather than compiled. Unlike compiled languages, these lanaguges tend to have very rich language features -- even if they don't represent direct hardware capabilities, for example, associative arrays and regular expression (pattern matching) operators. because of these powerful operators, software development tends to happen much faster than in compiled langauges, but without the overhead of managing multiple processes, as happens with shell scripts. Having said that, shell scripts can often accomplish more in fewer lines of code, because they are linking together whole programs -- not just rich libraries. And, compiled code tends to run faster, because, among other reasons, it is not interpreted on the fly. This semester, we'll study Perl -- but, maybe, in future semesters, it'll be Python. Maybe. Just maybe. Dunno.