home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeBook TitleSearch this book

0.2. Summary of Korn Shell Features

The Korn shell is the most advanced of the shells that are "officially" distributed with Unix systems. It's a backward-compatible evolutionary successor to the Bourne shell that includes most of the C shell's major advantages as well as a number of new features of its own.

Features appropriated from the C shell include:

Job control
The ability to stop jobs with CTRL-Z and move them to the foreground or background with the fg and bg commands.

Aliases
The ability to define shorthand names for commands or command lines.

Functions
The ability to store your own shell code in memory instead of files. Functions increase programmability and efficiency. (Functions have been common in the Bourne shell for many years.)

Command history
The ability to recall previously entered commands.

The Korn shell's major new features include:

Command-line editing
This feature allows you to use vi or Emacs-style editing commands on your command lines.

Integrated programming features
The functionality of several external Unix commands, including test, expr, getopt, and echo, has been integrated into the shell itself, enabling common programming tasks to be done more cleanly and without creating extra processes.

Control structures
Additional flow-control structures, especially the select construct, enable easy menu generation.

Debugging primitives
These features make it possible to write tools that help programmers debug their shell code.

Regular expressions
Well known to users of Unix utilities like grep and awk, regular expressions (albeit with a different syntax) have been added to the standard set of filename wildcards and to the shell variable facility.

Advanced I/O features
Several new facilities for control of process I/O, including the ability to do two-way communication with concurrent processes (coroutines), and to connect to network services.

New options and variables
These options and variables give you more ways to customize your environment than the standard Unix shells do.

Increased speed
The Korn shell often executes the same shell program considerably faster than the Bourne shell does.

Security features
Features designed to help protect against "Trojan horses" and other types of break-in schemes.

Major new features in the 1993 version include:

POSIX compliance
Compliance with POSIX, an international standard for portable shell programming, makes it possible to write and use portable shell scripts.

Arithmetic for loops
This new control structure lets you program more naturally when looping a fixed number of times.

Floating-point arithmetic
The ability to use floating-point numbers and new built-in arithmetic functions enrich the shell as a programming language.

Structured variable names
New syntax for variable names provides facilities similar to C structures and Ada records for grouping related items together in a variable.

Indirect variable references
This facility eases shell function programming for manipulating global variables.

Associative arrays
A powerful data-management facility that is similar to those in awk or perl.

Additional text manipulation facilities
There are even more ways to match patterns and substitute variables.

More built-in commands
Additional commands improve efficiency and increase script portability.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.