475 lines
19 KiB
Plaintext
475 lines
19 KiB
Plaintext
This is a list of changes that have been made since the 06/03/86 version
|
|
of ksh.
|
|
|
|
1. New features in 11/16/88
|
|
a. Additional pattern matching capabilities have been added.
|
|
A pattern-list is one or more patterns separated by |.
|
|
The following can now be all or part of a pattern:
|
|
1. ?(pattern-list) - allows any pattern to be optional
|
|
2. *(pattern-list) - matches zero or more of any pattern
|
|
3. +(pattern-list) - matches one or more of any pattern
|
|
4. @(pattern-list) - matches one of any pattern. The @
|
|
is optional for nested patterns.
|
|
5. !(pattern-list) - matches everything, except any of the
|
|
patterns.
|
|
|
|
b. A new compound command beginning with the new reserved
|
|
word [[ and ending with the new reserved word ]] has been
|
|
added. This compound command is intended to replace both
|
|
test and [. The operators && and || replace -a and -o.
|
|
Unquoted parenthesis are used for grouping. The words
|
|
between [[ and ]] are not expanded for word splitting
|
|
and pathname expansion. The operators = and != allow the
|
|
right hand side to be a pattern. You can also specify
|
|
< and > within [[ ]] to compare two strings. Also the
|
|
following test primitives have been added to test, [ and [[:
|
|
1. -O file, returns true if file is owned by effective user.
|
|
2. -G file, returns true if file is owned by effective group.
|
|
3. -S file, returns true if file is of type socket.
|
|
4. -a file, returns true if file exists.
|
|
5. -o option, returns true if option is on.
|
|
6. Extra arguments are no longer result in an error.
|
|
This increases compatibility with the Bourne shell.
|
|
7. File names of the form /dev/fd/NN can be used to check
|
|
the attributes for file descriptor NN.
|
|
|
|
c. The operators &&, ||, &, |, ^, <<, >> and ~ have been added
|
|
the the arithmetic evaluator. You can use them in any
|
|
arithmetic expression. Also, all the assignments operators,
|
|
+=, etc. are now recognized by ksh. The precedences and
|
|
associativity of ksh arithmetic operators are the same as
|
|
those of the C programming language.
|
|
|
|
d. Several options have been added or changed.
|
|
1. A noclobber option has been added. With noclobber
|
|
set, > file produces an error when file exists.
|
|
Use >| file to write to file even if noclobber is set.
|
|
2. A nolog option has been added. Nolog disables
|
|
the saving of the source for functions in the
|
|
history file.
|
|
3. bgnice is now turned on by default when interactive.
|
|
4. The meaning of the -p option has been changed
|
|
as well as its name. In the previous version,
|
|
-p caused the path to be reset to a default value
|
|
and the shell not to run your personal .profile
|
|
and $ENV file. Instead, the shell executed a file
|
|
named /etc/suid_exec. The -p option was enabled
|
|
automatically whenever the real and effective user
|
|
or group id were not equal. This was called the
|
|
protective option. With the new release, the -p
|
|
no longer resets the path to a default value. In
|
|
addition, the effective user id and group id are set
|
|
to the real user id and group id unless the shell
|
|
has been invoked with the -p options which is now
|
|
called privileged. In addition, turning off
|
|
privileged, (set +p) sets the effective ids to
|
|
their real values. On some systems you the command
|
|
set -p will restore the permissions to the way that
|
|
they were before the set +p.
|
|
|
|
e. Six new variables have been added.
|
|
ERRNO - set to the value of errno after each system call.
|
|
LINENO - set to the line number of current command.
|
|
PS4 - evaluates to prompt used with set -x, default '+ '.
|
|
FPATH - used to search for function definitions. The FPATH
|
|
directories are searched after the PATH variable.
|
|
If a file is found, it is dotted into the environment
|
|
and then it tries to execute a function of the
|
|
given name. The declaration typeset -fu name, causes
|
|
name to be searched for in FPATH directories before
|
|
searching PATH. A preset alias, autoload='typeset -fu',
|
|
has been added.
|
|
OPTARG - used with the getopts built-in.
|
|
OPTIND - used with the getopts built-in.
|
|
|
|
f. The following changes and additions have been made to the
|
|
editing modes:
|
|
1. Searches starting with a ^ now only match at the
|
|
beginning of the line in both emacs and vi mode.
|
|
2. Searches are performed much faster than with
|
|
earlier versions.
|
|
3. The | directive has been added to vi
|
|
4. The r directive of vi can now be preceded by a count.
|
|
5. The new vi directive \ causes the current word to
|
|
be extended as far as possible as long as it matches
|
|
a unique pathname.
|
|
6. Emacs <ESC><ESC> now behaves like vi \ above.
|
|
7. Undefined <ESC> sequences in emacs now beep.
|
|
8. Emacs keeps prompt on screen when scrolling.
|
|
9. Last delete saved across commands in emacs.
|
|
10. M-^]c, moves back to character c.
|
|
|
|
g. A DEBUG trap has been added to aid debugging. This trap
|
|
gets executed after each statement. Also, set -x now
|
|
displays I/O redirections.
|
|
|
|
h. You can now assign an array with set -A array_name value...
|
|
|
|
i. Aliases will now be expanded inside other alias. Thus, if
|
|
alias foo=bar bar=bam then foo will expand to bam. However,
|
|
an alias will not re-expand within its own expansion so you
|
|
can alias ls='ls -C'. If you alias foo=bar bar=foo, then
|
|
foo will expand to foo and bar will expand to bar.
|
|
|
|
j. The commands typeset and alias now allow option arguments
|
|
as separate words, rather than all in one word. For example,
|
|
typeset -ux and typeset -u -x. Also commands that allow
|
|
multiple options, now allow you to specify -- as an
|
|
indicator that there are not more options. This is needed
|
|
in case the next argument starts with a -.
|
|
|
|
k. The attributes for exported variables are now passed through
|
|
then environment. Thus setting a variable readonly and
|
|
exporting it will cause it to be readonly whenever a shell
|
|
is invoked. The IFS parameter is reset to the default value
|
|
even if you export it, after reading the environment file.
|
|
|
|
l. If the last element of a pipeline is a built-in, a compound
|
|
command or a function, then it is now executed in the current
|
|
process environment. If you require the previous semantics
|
|
then you must use parenthesis. All the other elements
|
|
of a pipeline are carried out in a separate environment and
|
|
any changes are not brought back to the parent environment.
|
|
This remains a caveat and you should use parenthesis if you
|
|
require that they be carried out in a separate environment.
|
|
|
|
m. The ~ expansion now uses yellow pages on systems that
|
|
provide this network service.
|
|
|
|
n. The expansions for ~, ~+ and ~- have been changed to expand
|
|
to $HOME, $PWD and $OLDPWD respectively. Previously, they
|
|
returned the value of the home directory, the present working
|
|
directory and the previous working directory at the time
|
|
they were read. This caused surprising results when used
|
|
within scripts or functions.
|
|
|
|
o. The getopts built-in from System V release 3 has been added.
|
|
|
|
p. You can now move the file descriptors for a cooperating
|
|
process (a job followed by |&), to numbered files by using
|
|
exec n<&p for the read descriptor and exec n>&p for the
|
|
write descriptor, where n is a digit. Once you move this
|
|
descriptor you can close it or redirect any command to or
|
|
from it.
|
|
|
|
q. The built-in commands break, continue, and exit now behave
|
|
like special built-ins and have a dagger in front of them
|
|
on the man page.
|
|
|
|
r. Each pattern in a case statement will now allow an optional
|
|
open parenthesis. The open parenthesis is required when
|
|
a case statement is part of a $() command substitution.
|
|
|
|
s. The previously unadvertised <> redirection operator, now
|
|
works. This operator causes a file to be opened for read
|
|
and write. The file is not truncated.
|
|
|
|
t. The alert character sequence \a has been added as an
|
|
escape sequence to the echo and print built-in commands.
|
|
The sequence \a will expand to the ASCII Bell character.
|
|
|
|
u. When ksh reads an unquoted ${, it now reads until the
|
|
matching unquoted } as part of the same word. Thus,
|
|
you do not need to use quotes to put most blanks and
|
|
most other special characters inside ${...}.
|
|
|
|
v. Code for BSD style job control for System V is now
|
|
conditionally compiled with the SIGTSTP signal. These
|
|
should work with any POSIX conforming job control
|
|
implementation such as System V Release 4. Also, can now
|
|
refer to jobs as %?string to match a job that contains
|
|
string as part of its name.
|
|
|
|
w. A trap on CHLD will be executed when a child process
|
|
stops or exits. Thus, with monitor mode on, you can set
|
|
trap 'jobs -n' CHLD to get the csh, set notify behavior.
|
|
|
|
x. The -p option has been added to whence to find the pathname
|
|
of a given name, even when the name is an alias or function
|
|
name.
|
|
|
|
y. Options -L and -P have been added to pwd and cd on systems
|
|
with symbolic links. The default, -L, preserves logical
|
|
naming so that .. will move up one component towards the
|
|
root. The physical option, -P, uses a physical model for
|
|
paths. Thus, if /usr/include/sys > /sys/h, then cd
|
|
/usr/include/sys;pwd;pwd -P, will print /usr/include/sys
|
|
followed by /sys/h. A cd .. will put you in /usr/include,
|
|
whereas a cd -P .. will put you in /sys.
|
|
|
|
z. $((expression)) expands to the value of the enclosed
|
|
arithmetic expression.
|
|
|
|
aa. The argument to umask can also be a symbolic string in
|
|
the format of a chmod permission string.
|
|
|
|
3. Bugs fixed since 06/03/86
|
|
a. typeset -LZ2 x, followed by integer x, created a base 2
|
|
integer variable x. This now correctly makes x base 10.
|
|
|
|
b. Single quoted strings with adjacent characters $( sometimes
|
|
did not work correctly. This has been fixed.
|
|
|
|
c. The suid_exec program now works correctly for setuid scripts.
|
|
The fix in the 06/03/86a release solved the security problem
|
|
but caused setuid scripts with read permission to fail.
|
|
|
|
d. A bug in the MULTIBYTE version which could cause core dumps
|
|
on variable assignments has been fixed.
|
|
|
|
e. The following parameter expansion bugs have been fixed:
|
|
1. Expansions of the form ${x-'${...}'} incorrectly
|
|
evaluated to ${x}} when x was set.
|
|
|
|
2. Expansions of the form ${x+$} and ${x+$\}} displayed
|
|
the message 'bad substitution' when x is not set.
|
|
|
|
3. The expansion "${x:=a b}" now expands to a single
|
|
argument when x is not defined. It previously
|
|
expanded to two arguments.
|
|
|
|
f. Non-builtin command incorrectly had backslashes removed
|
|
from the command before execution. Thus '\date' would execute
|
|
the date command. This has been fixed.
|
|
|
|
g. On some versions of Unix the shell did not die when sent
|
|
a hangup signal while in an editing mode. This has been
|
|
fixed.
|
|
|
|
h. Some fixes have been made to the the emacs edit directives.
|
|
1. M-< now works as documented.
|
|
2. ^N now works correctly after ^P reaches the oldest
|
|
command from the history file.
|
|
3. ^W now works no matter what your backspace character.
|
|
4. Scrolling now works correctly when you prompt is longer
|
|
than half the width of your screen.
|
|
5. Pathname completion no longer causes a core dump on
|
|
system that don't allow references to 0 when you expand
|
|
a word that expands to a null string, i.e. $foo.
|
|
6. M- before a newline or return no longer has an effect.
|
|
|
|
i. Some fixes have been made to the the vi edit directives.
|
|
1. Lines of one character in length now work.
|
|
2. The . directive now works correctly after the R directive.
|
|
3. The ~ directive now works correctly when preceded by a count.
|
|
4. The directives c0, d0, cb and db now work.
|
|
5. You can now use ESC to cancel r, f and @ directives.
|
|
6. On System V, if you have ignoreeof set, and you enter
|
|
EOF, you no longer receive 'use exit to logout' messages
|
|
when you subsequently hit ESC.
|
|
7. Tabs now get expanded to correct columns when ksh
|
|
redraws the line.
|
|
8. The e and E directives now ring bell when there are
|
|
no characters on the line.
|
|
|
|
j. Syntax errors in the ENV file now correctly list the name
|
|
of the ENV file as part of the message.
|
|
|
|
k. The let command when invoked as ((expr)) was fixed to work
|
|
correctly when expr contained $() or ``. Also subscripts
|
|
in variable assignments now work correctly when they contain
|
|
$() and/or ``.
|
|
|
|
l. The if..then..elif..fi now correctly handles redirection.
|
|
Previously redirection applied only to the elif portion.
|
|
|
|
m. A script containing lines like exec 3<file;read line <&3
|
|
read line <&3 didn't work correctly because of buffering
|
|
problems. This has been fixed.
|
|
|
|
n. On machines that do not allow referencing address 0, a
|
|
null command substitution `` or $() cased a core dump.
|
|
This has been fixed.
|
|
|
|
|
|
o. If you declared an integer variable and gave it a null string
|
|
as an assignment, then the value was randomly set. It is now
|
|
set to zero, i. e., integer x;x=.
|
|
|
|
p. If you have and alias to a single word command, and you use
|
|
the r predefined alias to reexecute it, you will no longer
|
|
get an extra newline displayed. An alias ending in space
|
|
no longer has an extra space displayed.
|
|
|
|
q. An alias of the form x='foo > file' incorrectly attempted alias
|
|
substitution on the first argument of x. This has been fixed.
|
|
Also, aliases and commands of the form, > foo x=bar command
|
|
are now correctly handled.
|
|
|
|
r. The parameter $! now gets set for cooperating processes.
|
|
|
|
s. Under some circumstances a write to an co-process did not
|
|
flush so that a subsequent read caused the process to hang.
|
|
This has been fixed.
|
|
|
|
t. When you invoke a shell procedure containing a here document
|
|
from within a command substitution contained in double
|
|
quotes, ( "`shell_prog`"), parameter substitutions inside
|
|
the here document no longer insert extra \'s.
|
|
|
|
u. A bug in line continuation caused lines ending in \x\ not to
|
|
be continued properly has been fixed.
|
|
|
|
v. The whence built-in command returned the wrong value when you
|
|
specified a full pathname and there was a tracked alias with
|
|
the same simple name. This has been fixed. Also whence no
|
|
always returns an absolute pathname for programs.
|
|
|
|
w. You can now specify typeset -fx before a function is defined
|
|
to set the x attribute. Before, defining a function cleared
|
|
the x and t attributes.
|
|
|
|
x. A trap on EXIT from within a function no longer affects the
|
|
return value of a function.
|
|
|
|
y. set -e and trap on ERR didn't get triggered in some cases where
|
|
it should have. This has been fixed.
|
|
|
|
z. A bug that caused the shell to hang when the shell timed out
|
|
and you had a trap on EXIT that did a command substitution has
|
|
been fixed.
|
|
aa. On some systems kill -l could cause a core dump. This has
|
|
been fixed.
|
|
|
|
bb. The ignoreeof option only applies when reading from a tty.
|
|
This prevents ksh from looping when running sh -i when reading
|
|
from a pipe or a file.
|
|
|
|
cc. case patterns of the form identifier[ are now processed
|
|
correctly.
|
|
|
|
dd. On some 16-bit machines $$ and $RANDOM were not getting set
|
|
correctly. This has been fixed.
|
|
|
|
ee. A space or tab at the end of a command is now placed in the
|
|
history file when preceded by a \ at the end of a command.
|
|
|
|
ff. ksh can now handle a signal that ksh does not know about.
|
|
This can happen when a signal ha been added after ksh was
|
|
compiled. It will print the signal number. On previous
|
|
versions the results were undefined and could even cause
|
|
core dumps.
|
|
|
|
gg. In instances where there are unbalanced quotes and ksh
|
|
allows unbalanced quotes, the results are now the same
|
|
as bsh. In some cases the last character was lost. For
|
|
example, x=`:|echo 'abc/` no longer removed the /.
|
|
|
|
hh. sh -n no longer loops indefinitely when you have
|
|
while looks in your script. Also, -n will make more
|
|
extensive syntax checks than earlier versions.
|
|
|
|
ii. A bug in read that caused the last field not to get
|
|
set to null when there were trailing delimiters has
|
|
been fixed.
|
|
|
|
jj. break 0 no longer puts you in a noexecute mode when entered
|
|
interactively.
|
|
|
|
kk. ksh no longer dumps core when expanding some long
|
|
substring patterns.
|
|
|
|
ll. A bug that caused exec not to find a program when
|
|
a PATH contained relative directory that contained it
|
|
has been fixed.
|
|
|
|
mm. Setting IFS to a null string, now correctly keeps ksh
|
|
from splitting up arguments after parameter and command
|
|
substitution.
|
|
|
|
nn. Unsetting PS1 no longer causes the shell to core dump
|
|
on systems that cannot access address 0.
|
|
|
|
oo. If a child process terminates with O_NDELAY (or FNDELAY
|
|
or O_NONBLOCK) set on the terminal, this no longer causes
|
|
the shell to exit.
|
|
|
|
pp. If you refer to a job using a prefix which is ambiguous,
|
|
a message is displayed. Previously, the prefix matched
|
|
the most recent job starting with this prefix.
|
|
|
|
qq. ksh now produces syntax errors when the last element
|
|
of a pipeline is omitted, for example a | &.
|
|
|
|
rr. Here-documents containing expansions of the form ${x-y},
|
|
or other operators, now work correctly when y contains
|
|
double quotes and/or backslashs. Double quotes are
|
|
not treated specially inside a here-document and a \
|
|
is only special when followed by a $, `, and \. This
|
|
was a bug in the Bourne shell also.
|
|
|
|
ss. The read built-in now treats \ as an escape character
|
|
when reading input if you do not specify -r. This is
|
|
the same as with the Bourne shell.
|
|
|
|
tt. sh -t now works that same as with the Bourne shell.
|
|
|
|
uu. "${x[*]}" now always expands to a single argument.
|
|
|
|
vv. If you do not specify a size with typeset -R, -L,
|
|
or -Z, the size gets defined on the first assignment.
|
|
|
|
ww. When set -k is on, words in a for list of the form
|
|
name=value are no longer discarded.
|
|
|
|
xx. A dot script that dots itself recursively, no longer
|
|
produces a core dump. It now prints an error message.
|
|
|
|
yy. ksh script requires execute permission for script
|
|
when using PATH to find script.
|
|
|
|
zz. The exit status of all commands is now limited to
|
|
between 0 and 255. Previously, builtin commands
|
|
could have other return values.
|
|
|
|
aaa. If the ENV file contained functions that used here
|
|
documents, then "sh -c prog" no longer leaves temporary
|
|
files around.
|
|
|
|
bbb. (trap 'echo foobar' 0; date) now executes the exit
|
|
trap. With Bourne shell and earlier ksh it didn't.
|
|
|
|
ccc. The shell no longer aborts when the history file grows
|
|
larger than ulimit.
|
|
|
|
ddd. An expansion of the form ${name%/\*} no removes only
|
|
a trailing /*. Previously in removed / followed by
|
|
anything.
|
|
|
|
4. The source code has undergone significant modification.
|
|
a. The SXT conditional compilation has been removed and all
|
|
the code in the jsh directory has been stripped out.
|
|
|
|
b. Most configuration parameters now get generated rather
|
|
than relying on testing which system you are on. This
|
|
should make it easier to port to hybrid systems. Other
|
|
options are now set in the OPTIONS file.
|
|
|
|
c. The are several new compile time options. See the README
|
|
file for details.
|
|
|
|
d. There is no more standard makefiles with this distribution.
|
|
The build procedure is written in native V7 Bourne shell.
|
|
There is also a 4th. generation make (nmake) Makefile
|
|
for those lucky enough to have this tool.
|
|
|
|
e. There are far fewer global names. This should make it
|
|
must easier to add built-in commands without worrying
|
|
about conflicts.
|
|
|
|
f. The code no longer uses standard I/O. This should make
|
|
it easier to port.
|
|
|
|
g. There are ANSI C prototypes for most of the external routines
|
|
|
|
h. Several minor performance enhancements should make startup
|
|
faster and should make some scripts run faster.
|
|
|
|
|
|
5. Incompatibilities with 06/03/86 version.
|
|
a. name=value ... is now evaluated left to right in accordance
|
|
with POSIX.
|
|
|
|
b. Aliases and functions defined in the $ENV file without -x
|
|
are removed before running a script.
|