David Korn continues to enhance the Korn shell at AT&T Bell Labs.
At this writing, a new release is in beta test-usually the
final step before a piece of software is released.
However,
negotiations between AT&T and USL (now Novell UNIX Systems Group) over
distribution rights could very well postpone the new shell's
public release for a couple of years or more.
Nevertheless, the new Korn shell has significant enhancements
that make it worth looking forward to. These features are subject
to change between the
time of this writing and the new shell's public
release. Here are some highlights:
-
The ability to customize key bindings, as in
bash
and
pdksh
but applicable to
vi- as well as emacs-mode.
This is implemented
as another "fake signal" trap (on keystrokes), so
it's extremely flexible.
-
Many new customization variables and options.
-
A greatly expanded set of string operators, providing
substrings, substitutions, and other functionality.
-
An enhanced array variable facility that provides for
associative arrays, which can be addressed by their
contents rather than by indices.
-
Better prompt string customization capabilities
(with command substitution and arithmetic expression evaluation).
-
Floating point (real number) arithmetic.
-
An arithmetic
for
loop in the style of the C
programming language.
-
A new option to
print
that allows C language
printf()
-style output formatting.
-
The ability to add new built-in commands, on systems
that support dynamic loading (the
dlopen()
system call).
-
More user control over command lookup order,
as in the POSIX standard and
bash
.
-
The ability to set timed "alarms" (with the ALRM signal).
-
Expanded debugging support through additional fake signal traps.
-
Online help for built-in commands through a standard
-
?
option.
The next release is expected to be incompatible with
the 1988 Korn shell in a few ways, some of which are
necessary for POSIX compliance (refer to the section
on POSIX in this Appendix for more details):
-
The
alias
command will never display tracked
aliases unless you specify the option
-t
.
-
Functions defined with
fname()
(the syntax not used in this
book) will have weaker
POSIX-compliant semantics. However, functions defined
with
function
fname
will remain the same.
-
Tilde expansion can take place inside
${
...
}
-style
variable expressions, whereas in the 1988 Korn shell,
tildes in these expressions are treated literally.
-
!
will be a keyword, as it is in the POSIX standard.
-
Command substitution and arithmetic expression evaluation
(in addition to parameter expansion)
will be performed on the variables
PS1
,
PS3
, and
ENV
when they are expanded. This will allow for more flexible
customization of prompt strings and environment files.
It also means that grave accents (
`
)
and
$(
must be quoted to be taken literally.
-
Output of the built-in commands
set
,
typeset
,
and
alias
will change so that any words containing
special characters are single-quoted-so that these commands'
output can be used directly for input.
-
A new expansion operator,
$
'
...
'
, is used to
delimit strings that conform to the ANSI C language standard
for character strings. In the 1988 Korn shell,
$
'
causes
the dollar sign to be treated literally; in future releases,
it must be backslash-escaped.
-
command
will be a built-in command, as in POSIX.
-
Command lookup order will change so that built-in commands
will be treated as if they were installed in
/bin
, i.e.,
will be found at the same time as
/bin
is searched
when the shell goes through your
PATH
.
The rules will also change to comply with the POSIX
standard that allows certain
built-in commands to take precedence over functions.
-
Signal traps will propagate to subshells (whether nested or shell
scripts invoked from shells) until the subshell issues a
trap
command (on any signal). Currently, traps do
not propagate to subshells; see
Chapter 8
.
-
The built-in variable
ERRNO
will be dropped;
exit statuses will reflect system call error numbers.
Finally, the following features are expected
eventually to become obsolete:
-
The command
fc
will be renamed
hist
;
the built-in variable
FCEDIT
will be renamed
HISTEDIT
.
-
The
-t
option to
alias
,
set -h
, and
set -o trackall
. Alias tracking will always be on.
-
The
-k
or
-o keyword
option.
This will always be off (see
Chapter 3
).
-
Grave accents (
`
) for command substitution.
Use
$(
...
)
instead.
-
The
-a
(file existence)
condition test will be renamed
-e
,
to avoid clashing with the
-a
operator (logical "and")
in the old
test
or
[
...
]
syntax.
-
The
=
pattern-matching operator in
[[
...
]]
condition tests
will be replaced by
==
for better syntactic alignment
with the C language.
-
The arithmetic comparisons
-eq
,
-lt
, etc.
Use
((
...
))
instead.
|
|