Hamilton LaboratoriesHamilton C shell 2012User guide


Oregon Coast

Getting started
Previous | Next


The C shell command prompt
Basic statements
Customizing the screen colors
The tour begins here
See also

The C shell command prompt

Starting Hamilton C shell is as simple as just double-clicking the icon. After the initial greeting, you’ll see the first prompt.

Hamilton C shell(tm) x64 Release 5.1.d Copyright (c) 1988-2014 by Hamilton Laboratories. All rights reserved. 1 C% _

The 1 C%  prompt tells you the C shell will remember what you type as command number 1 and that your current drive is C: (or whatever it is on your machine.) The % is traditional; rather like > for the Windows command prompt.

When it starts, the current directory is your home directory, typically c:\Users\your-user-id. The C shell’s cd command works like the regular Windows cd by default: If you don’t give it any argument, it reports the current directory.

1 C% cd c:\Users\Hamilton 2 C% _

Naturally, you can change your prompt to be anything you like. For example, to get a prompt that looks like one you might get from cmd.exe:

3 C% set prompt1 = '$cwd> ' c:\Users\Hamilton> _

This works by taking the value of the cwd (current working directory) variable and pasting onto the end. The value is recalculated each time a prompt is given, so it always displays an up-to-date value. (Lists of all the builtin variables and procedures are given in later sections.)

To set it back:

c:\Users\Hamilton> unset prompt1 4 C% _

Basic statements

Generally speaking, whatever commands you might have typed into cmd.exe (or command.com) will still work here. Even an internal cmd.exe function like dir works:

4 C% dir Volume in drive C is Windows7 Volume Serial Number is C8D6-348A Directory of C:\Users\Hamilton 03/16/2012 12:43 AM <DIR> . 03/16/2012 12:43 AM <DIR> .. 03/13/2012 12:02 PM <DIR> Contacts 03/16/2012 02:17 AM <DIR> Desktop 03/13/2012 12:02 PM <DIR> Documents 03/13/2012 12:02 PM <DIR> Downloads 03/13/2012 12:03 PM <DIR> Favorites 03/13/2012 12:02 PM <DIR> Links 03/13/2012 12:02 PM <DIR> Music 04/18/2012 03:25 PM <DIR> Pictures 03/13/2012 12:02 PM <DIR> Saved Games 03/13/2012 12:02 PM <DIR> Searches 03/13/2012 12:02 PM <DIR> Videos 0 File(s) 0 bytes 13 Dir(s) 30,914,285,568 bytes free 5 C% _

But you also a complete set of Unix-style utilities, for example, ls.

5 C% ls Contacts Documents Favorites Music Saved Games Videos Desktop Downloads Links Pictures Searches 6 C% _

If the command you type refers to a .cmd batch file or a cmd.exe internal function, Hamilton C shell passes it to a child process running cmd.exe for evaluation. cmd.exe’s builtin functions are intercepted with aliases defined in in startup.csh. Everything else is evaluated directly by Hamilton C shell. For example, if you type the name of an .exe file, the appropriate CreateProcess call to the Windows kernel to start that program will be done directly by Hamilton C shell.

A bit-mapped hash mechanism is used so that when you type the name of a command, the shell zeroes right in on file you mean. It doesn’t have to check every path directory for every possible extension. Naturally, if you type a command that doesn’t exist, the shell complains:

6 C% zork csh: Couldn't find an executable file named 'zork'. 7 C% _

By being more than merely a wrapper around an existing command processor, several advantages are created: (1) performance is understandably (and visibly!) much higher and (2) limitations on command line lengths, etc., become the relatively generous limits of Windows, rather than the restrictive limits of cmd.exe.

Customizing the screen colors

The C shell’s inherits its default screen colors from the console window when it starts up. If you’ve started it the default shortcut, that’s white characters on a blue background unless you’ve changed it. Highlighting and color are used to make some things (special files, etc.) stand out. All the use of color or highlighting is completely customizable. You can choose anything you like and make changes by setting the COLORS and other environment variables. For example, to set black characters on a bright white background:

7 C% setenv COLORS = black on bright white

The tour begins here

The following chapters introduce the various facilities Hamilton C shell provides:

  1. Command line editing and filename completion.

  2. The builtin and external utilities.

  3. Basic features of shell: i/o redirection, pipes and command substitution; the history mechanism and wildcarding.

  4. Expressions, variables and aliases and the editing and quoting facilities.

  5. Programming constructs for condition-testing, iteration and procedures.

  6. Processes and threads and how an activity can be placed in the background..

See also

C shell command line options
Environment variables
Customizing the shell
Order of evaluation
Language reference
Pre-defined variables
Builtin procedures
Builtin utilities
External utilities
Predefined aliases
Sample scripts

Previous | Next

Getting started with Hamilton C shell

Hamilton C shell, as it first wakes up.

Getting started with Hamilton C shell

A first few commands.

You can set the screen colors to your taste.

You can set the screen colors to your taste.