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

Orr Dunkelman orr.dunkelman at gmail.com
Fri Oct 19 18:51:51 MSD 2007

On 10/19/07, Shlomi Fish <shlomif at iglu.org.il> wrote:
> Hi Orr!
> For some reason, I'm receiving the emails that you send to me, but not the
> emails you send to the mailing list. It's a bit annoying. And I do receive
> emails that get sent to the mailing list.

I don't know what is the cause of the problem.

I can only conjecture that you procmail me...

> Exactly. The point is not to teach the beauty of shell scripting.
> >
> Then what is the point? To teach a crippled programming language, not
> unlike
> many others?

Actually - yes.
The idealized version of the world where you teach only the useful staff is
far from being right for education due to many reasons. For example, the CS
dept. of the Technion still uses the assembler of PDP11 to teach assembler.
Now, if I had to "change" anything in CS in second semester, I would start
with PDP11 and not with CSH. The reason for that is (hopefully obvious). On
the other hand, the students will not gain much from this transition (in the
overall). On one hand, now they'll know assembler of i386 (which is
certainly more useful). On the other hand, now they'll have to spend lots
and lots of time on addressing the long jump vs. the short jump (and we are
not getting into the problems of 64-bit addresses!). So all in all, they
still teach PDP11 because they have a good reason (because they want to
teach the idea behind assembler, and not how to write assembly code for
i386. Once you get the general idea of assembly, switching from PDP11 to
i386 is only small details).

So I guess teaching TCSH had its merits in the past. You will need to ask
the teachers why they teach this.

> I suggest you'll approach the lecturers in charge to get a better
> > understanding why they teach this shell rather than that shell (like
> Eyal
> > did).
> Maybe I will. But I still think my Anti-csh page was a good idea for
> concentrating all the arguments in one place.

An Anti-XXXX page is always the wrong place to start any of these things.

> > As for the "beauty" thing - beauty is in the eye of the beholder.
> >
> True, but I think we all can agree that shell scripting without sed, awk,
> find, and much less Perl or whatever, is much less beautiful than shell
> scripting with them. And I don't see a point in teaching it this way.

No. We do not agree on that.

I used to do shell scripting in DOS (batch files), where sed, awk, and other
cool stuff were not available.

And we are talking about concepts. I find the concept of using a smaller
instruction set to be actually more elegant then using many commands (think
of interoperability of a DOS batch file between various windows
distributions without any real support for stuff).

> > 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.
> >
> > Yes and no.
> >
> > Unlike what many people think, installing software on a server with
> > multiple users is not as simple as running yum/rpm/whatever your distro
> is
> > using.
> >
> > It is an obligation by the staff to support, update (to some extent),
> > insure backward competability (in the case of updates), etc. The claim
> that
> > "It's easy to install" is wrong for systems which you do not own, nor
> > understand all the technical (or political) aspects related to.
> >
> Well, you can always install bash under some obscure path
> (like /usr/local/DO-NOT-USE/gnu/bin). That way it would be useful for the
> people doing the exercises, but people will know not to rely on it. And
> from
> what is said here:
> http://tech.groups.yahoo.com/group/hackers-il/message/4881
> Maintaining tcsh is quite an headache in itself. This is while bash tends
> to
> be pretty straightforward to maintain.

I am no longer a user of t2, but I would guess that they get the packages
for tcsh sent to them by the supplier.

And I would find the maintenance of both as easy to handle.

> > For us it is very easy to say "yeah, this can be solved by find". But
> these
> > students need to learn how to implement find in a crippled scripting
> > language, because when they'll leave the academy and go to the dark
> side,
> > a.k.a., industry, they will have to work on machines which are not even
> > POSIX complaint!
> And I expect these machines to have an equivalent to a find command. Or
> you
> can compile GNU find there.

Shlomi, I think you lack some experience in real life companies. In many
companies, you are not the owner of your machine (even in the CS dept., as
Eyal can attest). You are the user of the machine the company supplied you.
You cannot install whatever you like (due to legal issues, security reasons,
or personal vendettas (e.g., a system administrator who despises RMS
personally)). So you cannot do that.

What people who work on machines which do not even have a C compiler do?
(and btw, there are many such machines in the world, or more precisely, the
majority of them do not have C compiler). There is a whole set of embedded
systems, low-end devices, sensor networks, with very limited capability even
to store the binaries they really need, so talking about even an extra 1 KB
of a binary so Mr. Fish could use find in his shell script (rather than
implement it using what he has) is so out of the question.

Please note that it is easier for a person to learn to solve a problem with
limited tools, and then add more tools, rather than teaching him how to
solve a problem with all the tools, and then start to take them away.

Or in other words - The world is not made out of the standard IT you usually
see around yourself. It has way more than that!

But back to our point - yes, students should know how to implement something
> like find. But it's not a good practice to use it in one's shell script,
> not
> the right way to do it, and that's what find (which will take some time to
> implement properly by hand) is meant for.

According to your view.

According to my view, a programmer who cannot write for a restricted
environment is not mature enough. And if you think this is only a problem of
low end devices, I can assure you that driver developers also have to
squeeze their code, squeeze their memory usage, and use only a limited set
of instructions (as they work in kernel space rather than user space). Your
vision about teaching the students will lead to students who need to work
very hard to be able to work in kernel space.

An exercise of implementing a find-like command without using find may be a
> good one, but find should also be taught.

Only if the point is to teach UNIX nice tools. If the point is to teach
shell scripting, then this is far from being a necessity.
 They can mention that find exists afterwards, but only afterwards.

The computer graphics course in the CS dept. starts by teaching you to put a
dot on the screen. Then you write the library support for a line (despite
the fact there is such a command). Then, you write a library for polygons
(using the line command). Then you write library for objects (using
polygons) and then you start to handle the shading, blurring, etc.
At each point of time you can (in theory) use already given commands. But
the idea is to learn to develop these things.

> People, please remember we are talking on a degree in computer science (or
> > EE), i.e., you do not learn JAVA, you learn OOP methodology (for
> example,
> > by using JAVA). These two things are completely different.
> First of all, it's not "JAVA" it's "Java". Secondly, I agree, but if you
> learn
> shell scripting, then find is part of shell scripting.

Only in UNIX. Not in Windows (yeah, I know there is find for DOS, but, let's
be realistic, you cannot even compare the two, and as I said you cannot
install GNU tools whenever you go).

> oh, these kids who never worked on COBOL... ;)
> Let me know when you'll be ready to have COBOL as your shell. ;-)

I can tell you that there are systems with even more horrible shells. And
unlike people who live in the internet between CPUs of two cores with 2 GB
RAM, and 120 GB hard drive, there are people who live on ARM, 6805, or
slightly advanced FPGAs. These people have to make it with much less than
the first set of people have at their disposals.


Orr Dunkelman,
Orr.Dunkelman at gmail.com

"Any human thing supposed to be complete, must for that reason infallibly
be faulty" -- Herman Melville, Moby Dick.

GPG fingerprint: C2D5 C6D6 9A24 9A95 C5B3  2023 6CAB 4A7C B73F D0AA
(This key will never sign Emails, only other PGP keys. The key corresponds
to orrd at vipe.technion.ac.il)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://haifux.org/pipermail/haifux/attachments/20071019/a025a8c9/attachment.html 

More information about the Haifux mailing list