The C shell command prompt
Basic statements
Customizing the screen colors
The tour begins here
See also
Starting Hamilton C shell is as simple as just double-clicking the icon. After the initial greeting, you’ll see the first prompt.
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.
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:
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:
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:
But you also a complete set of Unix-style utilities, for example, ls.
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:
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.
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:
The following chapters introduce the various facilities Hamilton C shell provides:
The builtin and external utilities.
Basic features of shell: i/o redirection, pipes and command substitution; the history mechanism and wildcarding.
Expressions, variables and aliases and the editing and quoting facilities.
Programming constructs for condition-testing, iteration and procedures.
Processes and threads and how an activity can be placed in the background..
Installation
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