Why csh instead of sh? (includes free flame!)

Gordon Moffett gam at proper.UUCP
Wed May 16 15:28:48 AEST 1984


#
In response to my request for a sh -> csh translator, I have
already received two letters asking `WHY would you want to do that?'
and now I find that question posted to the net, so perhaps I can
forstall a deluge.

But first, a slight flame:  I guess you are all trying to be helpful
warning me against the evils of csh, but THAT WASN'T MY QUESTION!
I found this as annoying as asking about a good truffle shop and
being asked `Why would you eat chocolate?  It has caffiene in it!
...' and so on.  Annoying.  Questioning people's preferences is
pointless.

Now, why csh?  Because the particular script I want to translate is
heavily into using the test(1) and expr(1) commands, which are already
built-in to csh.  Yes, there will be overhead with a csh script start-up,
reading ~/.cshrc and all, but this will be offset by the numerous
calls to test and expr that I won't be using.

(As Kernighan & Pike point out, judicious use of sh's `case' construct
 will avoid having to call test(1) in some cases -- for pattern
 matching/string comparison -- but I've already done that as much
 as possible).

I generally prefer the speed of sh scripts and resort to csh for
instances like I have described above (though my login shell is
csh, nonetheless).

I believe we've already had a round of `csh vs sh' before, and I don't
wish to provoke another one.



More information about the Comp.unix mailing list