Previous Table of Contents Next


Quoting provides a way to override special meaning of certain words or characters. If a word or character is quoted, then the shell will not interpret its special meaning. There are three types of quoting. The following list describes each type.

\ Backslash quoting. Each special character may be preceded by a backslash to escape its special meaning. By placing a backslash at the end of a line the new-line is removed; therefore, long lines can be separated into shorter, more readable lines. The problem with using \ is that it becomes cumbersome.
"..." Double quotes. Double quotes allow command and parameter substitution but escape the meaning of all other special words and characters. All text between double quotes is considered one parameter. A backslash quotes the \, `, ", $, and new-line characters within double quotes.
'...' Single quotes (apostrophe). Single quotes provide the most stringent form of quoting. All characters inside single quotes are interpreted with no special meaning. The backslash has no special meaning inside double quotes. Thus it is interpreted as itself, a backslash.

The following examples demonstrate the quoting aspects of the shell.

     cj> echo "My login shell is $SHELL"
     My login shell is /bin/ksh
     cj> echo "My login shell is \$SHELL"
     My login shell is $SHELL
     cj> echo "Spaces          are retained inside double quotes"
     Spaces          are retained inside double quotes
     cj> echo 'My login shell is $SHELL'
     My login shell is $SHELL


Integer arithmetic is performed by using the internal let command. Evaluations are carried out in long arithmetic. The let command provides faster execution and more understandable syntax than the expr command. The let command is described in Module 73.


If the shell is used interactively, it prompts you with the value assigned to the PS1 variable. If a new-line is typed and further input is needed to complete the command, the value of PS2 is displayed. The value of the PS3 variable is used as the prompt for the select command. If you place an exclamation point in the PS1 or PS2 string, the current event number is displayed. For example, PS1="`hostname`[!]: " produces a prompt like cj[23]:.

C Shell
The C shell prompts with the value stored in the prompt variable if the shell is interactive. If the shell is not interactive then prompt is unset. If an exclamation point (!) is placed in the prompt string, it is replaced by the current event number. For example, set prompt="`hostname`[!]: " produces a prompt like cj[23]:.


The shell maintains an environment that consists of named variables and their values. These named variables have been exported or made global by the shell during execution. Any exported named variable is considered part of the environment and can be accessed by any child process. The export and typeset commands can be used to export a named variable to the environment. Refer to Modules 47 and 145 for explanations of these two commands.

The -k option causes all named variables to be exported as they are assigned values. Keyword parameters may be used on command lines to export the keyword parameter for the simple command that immediately follows. The -a option allows the keyword parameters to precede or follow the command.


Job control allows you to stop, suspend, and start jobs as desired. There are commands to move jobs from background to foreground and vice versa. The shell associates an integer number with each background process. By referring to this number you can manipulate the execution of each job placed in background. For more information on job control, foreground, and background commands refer to the following modules:

Module 9 bg Place job in background to continue execution.
Module 51 fg Place job in foreground.
Module 68 jobs, % List and manipulate suspended, stopped, and executing jobs.
Module 125 stop Stop execution of a background job.
Module 129 suspend Suspend current program execution.

Most System V based systems, prior to System V Release 4.0, do not support job control. Nor does the sh. The csh and ksh support job control on systems that have the capability in the kernel. All BSD UNIX systems support job control and a few enhanced System V systems. System V Release 4.0 also supports job control.


The shell saves each command line you type and send to UNIX for execution in the history file. The fc command allows you to list and execute previous commands without retyping the entire command. The history command is an alias provided to list out these commands saved in the history file. The fc command is described in Module 50 and the history command is described in Module 64.


In-line editing allows you to make corrections to a command you are currently typing or to a previous command stored in the history file. To activate in-line editing you must have the EDITOR variable set to vi or emacs. You may use the set -o vi or set -o macs command to select an in-line edit mode.

Once the in-line editing mode is activated you can edit your commands and resend them to UNIX by typing a Return. For some shells to send the command line to UNIX the Return must be a Ctrl-J character instead of Ctrl-M.

The window is a single line that can be scrolled left or right. If text is scrolled off on the left of the screen, a greater than sign (>) appears. If text is scrolled off on the right side, a less than sign (<) appears. The width of the screen can be set by using the COLUMNS variable. The default for COLUMNS is 80.

Emacs Editing Mode

The emacs editing mode is based on the emacs editor. For further information about editing the history file using emacs commands refer to Module 50.

Previous Table of Contents Next