[Haifux] My "Stop Using (and Teaching) C-Shell and Tcsh" Page

Ohad Lutzky lutzky at gmail.com
Mon Oct 15 15:34:01 MSD 2007


A few more notes...

I'll make it short (it's 1:35am here  :-)  without looking at the references
> (sorry, I'll look at them sometime later, but I doubt they will change
> my reply).  1. C-Shell is taught as a "tool" for manipulating programs
> (in MaTaM's view, especially for testing) - this answers also the Q
> of "why scripting at all?"  2. Students are not expected to become
> Csh experts (I may agree that some technical details that are taught
> are not necessary) but they are expect to understand its usefulness.
> In that respect - any scripting language will do, even Perl.


Actually, a great deal of the problem I have is that  users aren't really
shown the benefits of scripting - they are given that as a constraint. The
exercises the students are given are, very often, solvable with one bash
script using sed, and in extreme cases - a simple perl one-liner. There is
an inherent problem designing a "big" exercise around shell scripting, which
is inherently at its best for small, interactive assignments. The students
don't learn to see shell scripting as a useful day-to-day tool, but as a
convoluted programming paradigm.

3. AFAIK all Technion servers are csh or tcsh (I don't know whether
> they provide bash) so it is the environment we have.


Ever since I've been a Technion student, bash was installed on T2, csl1, and
all of the farm boxes; I've never had access to TX, but I'd be extremely
surprised if bash weren't installed there.

4. Coming to think of it, the resemblance with C is an advantage
> (despite the "defects" and defects of csh).


Seeing as C and shell-scripting are used for inherently different purposes,
I do not see why this is an advantage; furthermore, I think that in the
exercises which are being taught, far too much stress is being put on loops
and "if" statemenets; Too little on effective usage of "&&" and "||"
operators. Also, extremely useful unix commands such as sed and find are not
taught, and I have actually seen an exercise given in the course where the
students implement a crippled version of "find". More relevant uses for
shell scripts are never brought as an example - students are not shown, for
example, how to use them in conjunction with "make" in order to create a
test suite for their programs. If you want to teach scripting - use a
scripting language (preferably something more organized than perl, like
Python). If you want to teach SHELL scripting, the exercises must be
relevant to that style of programming.

And two further notes on CSH itself:

* It is sometimes non-deterministic, as testified by Matam students;
* One-liners are not possible - blocks have to start on separate lines. This
makes tcsh very uncomfortable to use in interactive mode.
* Its syntax is, in certain cases, much more complicated than bash's: Files
are not auto-created when using the append (>>) operator, and outputting to
both
an stderr and stdout file is a mess. In bash it's just "command > outfile 2>
errfile", or for a combined version, "command > combinedfile 2>&1".



-- 
Man is the only animal that laughs and weeps, for he is the only animal that
is struck with the difference between what things are and what they ought to
be.
- William Hazlitt

Ohad Lutzky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://haifux.org/pipermail/haifux/attachments/20071015/6cf4cf3b/attachment.html 


More information about the Haifux mailing list