Hamilton C shell

Last updated
Hamilton C shell
Hamilton C shell x64 on Windows 7.png
64-bit Hamilton C shell on a Windows 7 desktop.
Original author(s) Nicole Hamilton
Initial releaseDecember 12, 1988;33 years ago (1988-12-12)
Stable release
5.2.g / March 5, 2017;4 years ago (2017-03-05)
Written in C
Operating system Windows (historically OS/2)
Type Unix Shell on Windows
License Commercial proprietary software
Website hamiltonlabs.com/Cshell.htm

Hamilton C shell is a clone of the Unix C shell and utilities [1] [2] for Microsoft Windows created by Nicole Hamilton [3] at Hamilton Laboratories as a completely original work, not based on any prior code. It was first released on OS/2 on December 12, 1988 [4] [5] [6] [7] [8] [9] and on Windows NT in July 1992. [10] [11] [12] The OS/2 version was discontinued in 2003 but the Windows version continues to be actively supported.

Contents

Design

Hamilton C shell differs from the Unix C shell in several respects. These include its compiler architecture, its use of threads, and the decision to follow Windows rather than Unix conventions. [8] [9]

Parser

Hamilton C shell and Cygwin bash on Windows 7, showing the use of recursion for factoring. Hamilton C shell and Cygwin bash recursion.png
Hamilton C shell and Cygwin bash on Windows 7, showing the use of recursion for factoring.

The original C shell uses an ad hoc parser. This has led to complaints about its limitations. It works well enough for the kinds of things users type interactively but not very well for the more complex commands a user might take time to write in a script. It is not possible, for example, to pipe the output of a foreach statement into grep. There was a limit to how complex a command it could handle. [13]

By contrast, Hamilton uses a top-down recursive descent parser that allows it to compile statements to an internal form before running them. [1] [8] As a result, statements can be nested or piped arbitrarily. [6] The language has also been extended with built-in and user-defined procedures, local variables, floating point and additional expression, editing and wildcarding operators, including an "indefinite directory" wildcard construct written as "..." that matches zero or more directory levels as required to make the rest of the pattern match. [14]

Threads

Hamilton C shell and Cygwin bash date loops. Hamilton C shell and Cygwin bash date loops.png
Hamilton C shell and Cygwin bash date loops.

Lacking fork or a high performance way to recreate that functionality, Hamilton uses the Windows threads facilities instead. [6] [8] When a new thread is created, it runs within the same process space and it shares all of the process state. If one thread changes the current directory or the contents of memory, it's changed for all the threads. It's much cheaper to create a thread than a process but there's no isolation between them. To recreate the missing isolation of separate processes, the threads cooperate to share resources using locks. [15]

Windows conventions

Hamilton differs from other Unix shells in that it also directly supports Windows conventions for drive letters, filename slashes, escape characters, etc. [9]

Related Research Articles

Bash (Unix shell) GNU replacement for the Bourne shell

Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. First released in 1989, it has been used as the default login shell for most Linux distributions. A version is also available for Windows 10 via the Windows Subsystem for Linux. It is also the default user shell in Solaris 11. Bash was also the default shell in all versions of Apple macOS prior to the 2019 release of macOS Catalina, which changed the default shell to zsh, although Bash remains available as an alternative shell.

The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interfaces (API), along with command line shells and utility interfaces, for software compatibility (portability) with variants of Unix and other operating systems. POSIX is also a trademark of the IEEE. POSIX is intended to be used by both application and system developers.

Shell script Script written for the shell, or command line interpreter, of an operating system

A shell script is a computer program designed to be run by the Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text. A script which sets up the environment, runs the program, and does any necessary cleanup or logging, is called a wrapper.

OS-9 is a family of real-time, process-based, multitasking, multi-user operating systems, developed in the 1980s, originally by Microware Systems Corporation for the Motorola 6809 microprocessor. It was purchased by Radisys Corp in 2001, and was purchased again in 2013 by its current owner Microware LP.

C shell Unix shell

The C shell is a Unix shell created by Bill Joy while he was a graduate student at University of California, Berkeley in the late 1970s. It has been widely distributed, beginning with the 2BSD release of the Berkeley Software Distribution (BSD) which Joy first distributed in 1978. Other early contributors to the ideas or the code were Michael Ubell, Eric Allman, Mike O'Brien and Jim Kulp.

cd (command) Computer command in various operating systems

The cd command, also known as chdir, is a command-line shell command used to change the current working directory in various operating systems. It can be used in shell scripts and batch files.

In the Unix operating system, shar is an archive format created with the Unix shar utility. A shar file is a type of self-extracting archive, because it is a valid shell script, and executing it will recreate the files. To extract the files, only the standard Unix Bourne shell sh is usually required.

An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.

AUTOEXEC.BAT is a system file that was originally on DOS-type operating systems. It is a plain-text batch file in the root directory of the boot device. The name of the file is an abbreviation of "automatic execution", which describes its function in automatically executing commands on system startup; the filename was coined in response to the 8.3 filename limitations of the FAT file system family.

Windows NT 3.1 32-bit cross-platform operating system developed by Microsoft

Windows NT 3.1 is the first major release of the Windows NT operating system developed by Microsoft, released on July 27, 1993.

Comparison of command shells Wikimedia list article

A command shell is a command-line interface to interact with and manipulate a computer's operating system.

Elvis (text editor) Enhanced clone of the vi text editor

Elvis is an enhanced clone of the vi text editor, first released in January 1990. It introduced several new features, including syntax highlighting and built-in support for viewing nroff and HTML documents. Elvis is written by Steve Kirkendall and is distributed under the Clarified Artistic License (ClArtistic) which is used by Perl and is a GPL-compatible free software license.

Shell (computing) Computer program which exposes an operating systems services to a human user or other programs

In computing, a shell is a computer program which exposes an operating system's services to a human user or other programs. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer's role and particular operation. It is named a shell because it is the outermost layer around the operating system.

Tanenbaum–Torvalds debate 1990s debate regarding the Linux kernel

The Tanenbaum–Torvalds debate was a written debate between Andrew S. Tanenbaum and Linus Torvalds, regarding the Linux kernel and kernel architecture in general. Tanenbaum, the creator of Minix, began the debate in 1992 on the Usenet discussion group comp.os.minix, arguing that microkernels are superior to monolithic kernels and therefore Linux was, even in 1992, obsolete. The debate has sometimes been considered a flame war.

ManaGeR or MGR was an early windowing system originally designed and developed for Sun computers in 1984 by Stephen A. Uhler, then at Bellcore.

Linux Family of Unix-like operating systems

Linux is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged in a Linux distribution.

A batch file is a script file in DOS, OS/2 and Microsoft Windows. It consists of a series of commands to be executed by the command-line interpreter, stored in a plain text file. A batch file may contain any command the interpreter accepts interactively and use constructs that enable conditional branching and looping within the batch file, such as IF, FOR, and GOTO labels. The term "batch" is from batch processing, meaning "non-interactive execution", though a batch file might not process a batch of multiple data.

Usenet Worldwide distributed Internet discussion system

Usenet is a worldwide distributed discussion system available on computers. It was developed from the general-purpose Unix-to-Unix Copy (UUCP) dial-up network architecture. Tom Truscott and Jim Ellis conceived the idea in 1979, and it was established in 1980. Users read and post messages to one or more categories, known as newsgroups. Usenet resembles a bulletin board system (BBS) in many respects and is the precursor to Internet forums that became widely used. Discussions are threaded, as with web forums and BBSs, though posts are stored on the server sequentially.

Command-line interface Type of computer interface based on entering text commands and viewing text output

A command-line interface (CLI) processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor. Operating systems implement a command-line interface in a shell for interactive access to operating system functions or services. Such access was primarily provided to users by computer terminals starting in the mid-1960s, and continued to be used throughout the 1970s and 1980s on VAX/VMS, Unix systems and personal computer systems including DOS, CP/M and Apple DOS.

References

  1. 1 2 Early Hamilton C shell Quick Reference (PDF). Hamilton Laboratories, Wayland, MA. Jul 10, 1990. Retrieved July 28, 2016.
  2. Faught, Danny (Aug 31, 1996). "The shell game". Software QA Magazine. 3 (4). Archived from the original on March 1, 2012. Retrieved Apr 8, 2013.
  3. The author has discussed her transition from Douglas Hamilton on a panel discussion at Stanford, beginning at 29:37. Nicole Hamilton, Carl Ingram, Liz Kennedy Myers, Tom Mills, John Ordway, Scott Thatcher, Kirstie Wilde (Moderator) (Nov 28, 2007). Class of 1972 Panel Discussion: Hell No We Won't Go (Quietly Into the Night)!. Stanford Alumni Association, iTunes U. Retrieved July 28, 2016.
  4. Machlis, Sharon. "Wayland writer for IBM" (PDF). Middlesex News (Dec 18 1988): 2E. Retrieved July 28, 2016.
  5. Sussman, Ann. "Hamilton C Shell Speeds Development Of OS/2 Applications" (PDF). PC Week (Dec 26 1988 – Jan 2 1989): 37. Retrieved July 28, 2016.
  6. 1 2 3 Hamilton, Douglas A. "Hamilton C shell Announcement" (PDF). IBM Personal Systems Developer (Summer 1989): 119–121. Retrieved July 28, 2016.
  7. Richman, Scott (Jan 1991). "Examining the Hamilton C Shell" (PDF). Dr. Dobb's Journal. Retrieved July 28, 2016.
  8. 1 2 3 4 Goutal, Kenneth G. "The Hamilton C shell" (PDF). MIPS Magazine (Sep 1989). Retrieved July 28, 2016.
  9. 1 2 3 Yager, Tom. "OS/2, Unix Style" (PDF). BYTE Magazine (Feb 1990). Retrieved July 28, 2016.
  10. Hamilton C shell for Windows Release Notes 4.0, retrieved July 28, 2016.
  11. Hamilton, Doug (Jul 27, 1995). "Looking for C-Shell on NT". Newsgroup:  comp.os.ms-windows.nt.misc. Usenet:   hamilton.806823765@BIX.com . Retrieved Oct 8, 2010.
  12. Deignan, Michael P. (March 31, 1998). "Hamilton C Shell". Windows IT Pro. Retrieved September 22, 2019.
  13. Csh Programming Considered Harmful by Tom Christiansen
  14. "Wildcarding and pattern matching". Hamilton Laboratories. Retrieved August 13, 2018.
  15. Hamilton, Doug (Apr 21, 1995). "Suggestions for multiple-reader/single-writer lock?". Newsgroup:  comp.os.ms-windows.nt.misc. Usenet:   hamilton.798430053@BIX.com . Retrieved July 28, 2016.