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

Shlomi Fish shlomif at iglu.org.il
Thu Oct 18 16:33:44 MSD 2007


On Monday 15 October 2007, Ohad Lutzky wrote:
> 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.

Indeed. I always find it a curious fact when Matam/Mamat students were 
instructed to solve exercises without using sed or awk, or in one line of 
C-shell. This may indicate that they want to design clever exercises, but not 
to really teach the beauty of shell scripting.

>
> > 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.

Well, from what I understood, up to a point TX still carried a Perl that was 
9-years-old or so (Nadav can fill the details). But even if it didn't carry 
bash, then bash was easily installable 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.

Right.

>
> And two further notes on CSH itself:
>
> * It is sometimes non-deterministic, as testified by Matam students;

What do you mean by "non-deterministic"? Can you give an example.

> * One-liners are not possible - blocks have to start on separate lines.
> This makes tcsh very uncomfortable to use in interactive mode.

I know and I've explicitly mentioned it in my original article:

<<<<<<
Entire Bash mini-programs can be written, tested and debugged in one line. 
This is impossible to do in csh which forces loops to be on separate lines. 
>>>>>>

( http://www.shlomifish.org/open-source/anti/csh/ )

> * 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".

<nod />

Regards,

	Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
    -- An Israeli Linuxer



More information about the Haifux mailing list