Profile photo for Clem Cole

Like others, I agree the short answer is probably no, but instead of just ‘bashing’ on you or the cshell let me try to give you a little historical context to help explain why. Remember, that you need to start with the old UNIX maxim that says to “type to the csh and program the Bourne shell.” This still makes sense for many of us older hackers, but for a newer user, if you never learned the csh, it’s not clear that guideline is still worthwhile.

The longer answer follows: while it could be done, the original Thompson shell from the 5th and 6th edition The Unix [Open Source] Tree where you can browse the sources* . If you look at the sources, you will see it was not particularly easy to write scripts. So, the Bell Labs Research types who were developing UNIX, in this case lead by Stephen Bourne (then recently of the Algol68 project) set out to write a new shell to replace the old Thompson shell. The new shell was being built with script programming in mind and thus be based more in language design principles - making it easier to write same Stephen Bourne: Early days of Unix and the design of sh. Bourne started over V7/usr/src/cmd/sh and did not use any of Thompson’s code-base V6/usr/source/s2/sh.c, (including writing the code in the infamous Bourngol - C macros that made C look more like Algol68 – [Bourne Shell Macros, Marc Lehmann's "Bourngol Page" ]). The result would become the shell that was released in Seventh Edition and is consider the root of most shell discussions for all of the UNIX family since the time of its release.

However, while Bourne was doing his work, inside of the Susan Graham’s compiler research group in UCB a young grad student, named Bill Joy started with the Thompson code and started hacking on it to make it “better” 1BSD/ashell (BTW: in time it would be renamed the cshell 2BSD/src/csh). The code was hardly recognized as being based on the original Thompson shell but in fact was. Once released as part of BSD (a.k.a. the first Berkeley UNIX Software Distribution – check out the link to The First BSD** on: The Unix [Open Source] Tree.

Anyway, now we have the original Thompson shell, (i.e. the original UNIX), the new Bourne shell and Joy’s cshell – which all have 3 completely different programming syntax. It should be noted that Joy, at the time a language student, was influenced by C and the Algol languages such as Pascal at the time when he built the cshell syntax. As others have noted, the cshell syntax and semantics are own language and while you will find some small things common from the C language, generally the differences are far greater than the similarities.

Since the csh and Thompson shell (the original sh) were both developed before V7 was released by AT&T, when new UNIX features were added to V7, and UC Berkeley obtains the code, Joy needed to add support for them to the cshell, for instance for environment variables. Bourne had the advantage of developing his shell concurrently with the V7 kernel, so all features of the new system were well integrated as both were developed together. Since the cshell (a.k.a. ashell) was developed for 6th edition and as such had a number of things back fit into it; the two shells again had ways to be different.

BTW: As a historical note, with V7, the Research team replaced the Thompson shell with the Bourne shell, which was in fact fairly easy to do, because up until that time while there had been some scripting, because it was difficult with the older shell, it was not yet widespread. But because it replaced the Thompson shell, future generations rarely know about it, as the term ‘sh’ with any descriptors became synonymous with the Bourne shell in the UNIX world and would later become the basis for the Posix shell definition.

At the same time, the use of cshell was limited pretty much to UCB and not a lot scripts were written with it outside of UC Berkeley. The Seventh Edition of course, spread on the PDP-11 across the globe. The result was that the Bourne shell spread with it quickly as the lingua franca scripting language for UNIX.

The said, the cshell, while more difficult to program for scripts, had numerous short cuts developed that made it the easiest shell to use from a user interface stand point. In fact, it is still many people including my own preferred shell from the typing standpoint – if for no other reason that many of short cuts got programmed in the muscle memory of our fingers.

With the popularity of the Vax as the replacement for the PDP-11 and the UCB support for virtual memory that it contained, BSD 4.1 (which was a PDP-11/V7 derivative), both the Bourne shell and cshell were delivered to the users. But the cshell was the default shell for BSD and because it was easier in which to type, quickly became the primary shell for user to see when the logged in on most UNIX systems of the day.

So now we have a world with two basic shell syntaxes. The Bourne shell was everywhere and in fact was more simpler and more regular. Although, there were tricks and short cuts, that the cshell could do that did make some scripts easier to write; although it was generally agreed that there was nothing that it could do that could not done with the Bourne shell and usually the resulting script was a lot easier to understand. In practice, the primary places were you still saw cshell scripts was coming from UCB, but even there, many of their scripts were Bourne shell based also.

As you know the world did not stop, and Bourne shell was replaced by the Korn Shell. The ksh was syntactically a super set of the Bourne shell, but for reasons I will not repeat here was not generally available outside of the AT&T. Thus, the new Korn extensions to the Bourne shell really could not take hold because most user did not have a shell that supported them.

The result was that most UNIX implementation supported something that looked/was derived from the Bourne heritage and another that came from the cshell line. Thus the maxim was developed, because if you wrote your scripts in ‘pure Bourne’ (V7) syntax, you could be reasonably sure that your script would work on just about any UNIX system, no matter if it was an AT&T Korn Shell based or Bourne shell based or if it was a UCB based system because they all had the Bourne shell too.

Many other shells were developed by different people and apologies to anyone I may offend for not mentioning theirs in this short history. But the primary next important step was development of Bash or the “Bourne Again SHell.”

The developers of bash attempted to make it be all things to all people and is a little like the English language (or maybe a ‘camel’), and it imported a lot things from a lot of other places. It has become the default shell for Linux and MacOS for a number of solid and excellent reasons. The designers did follow the Bourne shell syntax and picked up many of the Korn shell extensions. They also folded in many of the tricks that the cshell has given us. But whatever reasons, the designers did not pick up all of the cshell’s short cuts as is (nor 100% of Korn either it seems although I have not pushed that a few years so some of that may have been corrected).

As a result, for an old guy like me, typing to bash can be a PITA because it does almost, but not quite what I want – as I say, the cshell actions are built into my muscle memory.

It does leave an open question. Programming… Bash seems to be ubiquitous in modern UNIX implementations. Bash does seem to be a super set of the original Bourne Shell, in that, while I’m sure there can be found examples, I have not so far found a case where an V7 syntax shell script has not ‘just worked’ when I fed it to bash for interpretation.

The problem is that bash extensions cannot be wholly trusted to be available unless a modern implementation of bash is there. This may or may not be true. Generally, my advice is the old “program the Bourne shell syntax” still holds. In truth, some of the Korn style extensions made it into the Posix Shell definition , so opening up a script to a Posix definition of the Bourne shell is probably reasonable in believing that can be everywhere. That said, as Linux has become the ‘standard’ UNIX implementation and most Linux’s distro provide a fairly current bash, this requirement is become less and less acute.

So, if I was a newish programmer my advice would be to learn to program the pure Bourne shell syntax, as you can pretty much trust that will work is all cases and you will not be ‘surprised’ if ever try to program an older UNIX implementation. But I would probably teach my fingers the bash short cuts at this point, only because of its current ubiquitous-ness and leave the cshell and its derivatives to the fingers of us old folks that are going to have a hard time reprogramming our muscles.

So today I think I would update the maxim to be: “type to the bash but stick to programming the Bourne (Posix) shell.

*Minor Footnote 1 the sources were in those days (and still are of course) “open source” in that anyone with an license could see them, then were just not “free’” as in beer - the license $100 for Universities - but at that price “the research” community all had them.

** Minor Footnote 2 to try to unconfused the readers. If you examine the ‘README’ file in the 1BSD you will see Bill refer to using the new V7 C compiler. Yet, V7 was not yet released. 1BSD is based on the Sixth Edition. So, how could this be? The compiler was on a separate release train from the OS.

Much later after the time he wrote that note, most of us would later refer to the version of compiler that Bill is referring to in here as the ‘Typesetter C’ compiler, because it was the C compiler developed and released with troff typesetter support independent of the OS (which is also how UCB got it). This version of the language actually is fairly close to the language described in the ‘White Book’ as Kernighan and Ritchie were also writing it concurrently. An even later version of the language would actually be released as part V7 a few years later, but by the time of the first BSD release, most of us in the UNIX community had been anticipating a new release from Ken and Dennis for a few years. So, Bill’s description of the next compiler as the V7 compiler made sense at the time and it was close, although not exactly the same bits.

View 4 other answers to this question
About · Careers · Privacy · Terms · Contact · Languages · Your Ad Choices · Press ·
© Quora, Inc. 2025