Shell Developing...NOT

Contents:
Why Not?
Shell Developing Considered Harmful
Conditional Statements with if
Shell Variable Operators and Expressions
Using C Shell Arrays
Quick Reference: C Shell switch Statement

Why Not?

We use the C shell for many of the interactive examples in this tutorial. History, aliases, and so forth make it far superior to the original Bourne shell for interactive use. (The newer Korn Shell combines features from both. And bash adds even more.) However, csh has some major drawbacks when it comes to shell developing.

Tom Christiansen explains some of the reasons in his famous tract "C Shell Developing Considered Harmful," which we've included as article . If you find yourself bristling at the tone of this article, remember that it was originally posted to Usenet (). It is an example of that art form known colloquially as a "flame." As flames go, this is actually fairly mild.

We agree with most of Tom's criticisms, and make no attempt to teach C shell developing in this tutorial. We do however include a few quick-reference style articles on constructs that we use in articles about the C shell's setup files (), since they are in effect nothing but C shell programs read when the shell starts up. Specifically, we cover the syntax of if () and switch () statements. We explain how to set and use C shell arrays ()- a nice C shell feature that, we admit :-), the Bourne shell is missing. (The foreach () loop, covered in another chapter, could be put in this chapter, too.) C shell expressions () (like $?prompt) can be used in if, switch, and foreach.

- TOR, JP