home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d03xx
/
d0342.lha
/
SKsh
/
Addendum1.4.doc
< prev
next >
Wrap
Text File
|
1990-04-15
|
27KB
|
793 lines
Addendum for Version 1.4
SKsh
A ksh-like Shell for the Amiga
Version 1.4
(Copyright) 1989, 1990
Steve Koren
March 20, 1990
Addendum to Version 1.4
This document describes additions and changes to SKsh since
version 1.3.
Beta version of tiny_sksh
SKsh 1.4 includes a preliminary version of tiny_SKsh, an
SKsh without command line editing, history, or a number of
builtin commands. It does, however, include the entire
SKsh command parser with all control structures, tests,
pipes, command substitution, shell functions, aliases, etc.
This shell is still a "beta" version - most of the SKsh
builtin commands are not yet provided as external commands
for tiny_SKsh. It is possible, however, to test whether a
given script is being run under full or tiny SKsh.
tiny_SKsh is described in more detail in the TinySKsh.doc
file.
SIZE variable added
A new SIZE variable has been added which contains either
"normal" or "tiny". It can be used to test for a specific
version of SKsh.
case...esac statement added
The case...esac construct now works in SKsh. It is mostly
compatible with the ksh or sh case statement. For example,
read answer
case "$answer" in
abc) echo 'You typed abc'
;;
d?f) echo 'you typed d-something-f';;
* ) echo 'you typed something else entirely,'
echo "which happens to have been $answer"
;;
esac
Like all other control structures, the case statement may
be used from either the command line or a script. The
case...esac statement is described in more detail in the
UserMan.doc file; please see that document for details.
SKsh Amiga Shell Page 2 Addendum to 1.4
complist command added
The SKsh file name completion mechanism has been extended
to handle arbitrary strings. SKsh maintains an internal
list of strings and performs command line completion on
these strings before performing filename completion. This
mechanism, which is described in more detail in the
reference manual, allows the following:
* A user defined list of completion strings can be
maintained to contain, for example, device or program
names (such as "graphics:" or "calculator") which are
commonly typed.
* The completion list can contain programs which are found
in the search path.
* The completion list can buffer the contents of the
current directory so that subsequent successful
completions do not have to read the directory. This
makes filename completion usable on a floppy based system
or on a hard disk when a directory contains a large
number of files. A shell function is supplied in the
Stuff.sksh file which adds the files in the current
directory to the completion list.
* Another function provided in the Stuff.sksh file adds
file names stored in a .zoo file to the completion list.
With a little work, the same mechanism could be extended
to .arc or .lzh files.
A new 'C' option has been added to turn this feature on or
off; see the options command for details. The complist
command is described in more detail in the Reference.doc
manual; see that document for more information.
Resident command support
SKsh now uses the ARP resident program standard. A
"resident" command has been added which allows programs to
be made resident or removed from the resident list. The
resident list can also be listed.
External commands now smaller, faster
The SKsh external commands have been significantly improved
both in size and performance over their 1.3 counterparts.
The following table gives a rough indication of performance
increases; times will, of course, vary depending on drive
controllers, disk buffers, other tasks running, etc. All
times are in seconds, and include time necessary to load
the command itself from disk:
SKsh Amiga Shell Page 3 Addendum to 1.4
f1 = 438522 byte, 51348 line ascii file
f2 = 426368 byte binary file
f3 = 12239 byte binary file
Command 1.3 1.4
---------------------------------------------------------
wc f1 >nil: 40 10
wc -c f1 >nil: 30 2
head -20000 f1 >nil: 20 3
tail -1000 f1 >nil: 30 1 (1)
cp f1 ram: 47 4
cp -n f1 nil: 44 2
strings f2 >nil: 43 17
cmp -s f2 f2 60 8
cmp -s f2 ram:f2 48 6
xd f3 >nil: 3 4
crc f2 >nil: n/a 7
fgrep 'the' f1 >nil: n/a 31 (2)
grep 'the' f1 >nil: n/a 94 (2)
(1) Difference mainly due to change in algorithm
(2) Lattice grep is 103 seconds
The commands are also much smaller in 1.4, averaging about
half their previous size. However, they now require the
arp.library.
Make sure you re-install the new commands in place of the
old ones.
Some external commands pure
Some of the SKsh external commands are now pure, and can be
made resident. To use this feature, set the pure bit on
the following files:
cmp cp du head
srun strings view wc
window xd
This can be accomplished with the SKsh "chmod" command.
The other external SKsh binaries can *not* be made
resident; a bug in the Lattice C compiler currently
prevents that. However, in a future release of SKsh, all
of the external binaries may be pure.
SKsh Amiga Shell Page 4 Addendum to 1.4
Backslash escape handling changed
SKsh backslash escape handling has been changed to be more
compatible with Un*x. Previously, a wildcard had to be
single or double quoted to turn off its magic properties;
now, it can be backslash escaped:
[prompt]: echo \* \*.\*
* *.*
Filename completion escapes wildcard characters
If command line filename completion is used to complete a
file which contains wildcard characters in the name (for
example, a file called "foo*bar", the completion mechanism
will automatically escape the wildcard character. For
example, "foo\*bar" would be inserted in the command line,
which is most often the desired string, since it will match
only the proper file.
Variable substitution mechanism changed
All versions of SKsh prior to 1.4 treated unquoted strings
with imbedded variables (such as foo$bar) different than
unquoted strings which contained only a variable expansion
(such as $bar). This often led to odd results; for
example, in version 1.3:
[prompt]: foo=blah
[prompt]: echo "$foo.ZZZ"
blah.ZZZ
[prompt]: echo $foo.ZZZ
blah .ZZZ <-- notice the extra space
SKsh 1.4 treats imbedded variable names the same as non-
imbedded variables:
[prompt]: foo=blah
[prompt]: echo "$foo.ZZZ"
blah.ZZZ
[prompt]: echo $foo.ZZZ
blah.ZZZ
SKsh Amiga Shell Page 5 Addendum to 1.4
Variables can now easily be concatenated to text
In SKsh 1.3, there was no easy way to concatenate the value
of a variable with some text. For example, if a variable
named "blah" had some value ("ZZZ"), then "$blahAAA" would
be an empty string, since the entire text ("blahAAA") was
taken to be a variable name. If it is really desired to
concatenate "AAA" to the value of the "blah" variable, it
can now be done as follows:
[prompt]: blah=ZZZ
[prompt]: a=$blah\AAA
[prompt]: echo $a
ZZZAAA
This avoids the ugly construct of:
[prompt]: a=$(echo -c $blah AAA)
However, the normal backslash escapes ("\n", etc) take
precedence over this mechanism.
New 'v' option flag added for variable/wildcard expansion
A new 'v' option flag has been added which controls the
expansion of variables which contain wildcard characters.
The easiest way to illustrate this is with an example.
Consider a directory containing 3 files, "a.foo",
"blah.foo", and "c.bar":
[prompt]: options -v; dum='*'
[prompt]: echo $dum.foo
*.foo
[prompt]: options +v
[prompt]: echo $dum.foo
a.foo blah.foo
In the second "echo" statement, the value of "dum" (which
happens to be the wildcard character "*") is used for
wildcard expansion. In the first case, (with the "v" flag
reset), it is not; the '*' is substituted as is. The "v"
flag is reset by default, as this is the Un*x behavior.
Directory expansion bug fixed
A somewhat obscure bug in the directory expansion mechanism
that evaded detection until now has been fixed. If
"nested" wildcards (such as */*) were used in a shell
command, and the top level directory contained both sub-
directories and files, SKsh would often crash if the number
of arguments was large (more than 20 or so). It no longer
does this. The following command now works correctly, even
for a large number of files:
SKsh Amiga Shell Page 6 Addendum to 1.4
chmod +wd * */* */*/*
Internal SKsh commands have no fixed limit on the number of
files which can be matched by a wildcard expansion; there
could be thousands, limited only by memory. However,
external binaries are still limited by AmigaDos to 255
character command lines.
fgrep, grep commands added
Two text search commands have been added which provide
nearly all the options of their Un*x equivalents. Only the
'-b' (block) option is not supported in SKsh. See the
documentation on those commands for details.
srun command added
The srun command allows other commands to be run in the
background. It differs from the AmigaDos run command (and
similar utilities such as RunBack) in that standard input
and output can be redirected, and stack size and priority
set for the background command. It is useful in scripts or
from the command line when a background command will use
the AmigaDos pipe: device. See the documentation on srun
for details.
view command added
The view command is a logical extension of the Un*x file
utility. view will attempt to guess a file's type based
upon either the contents of the file or the file's name.
It will then carry out a user defined action based upon
that file type; for example, it might invoke "show" on an
IFF bitmap file, "xd" on a binary file, "zoo -list" on a
zoo archive, or "lharc v" on an lharc archive. Its actions
are based on a configuration file so that new file types
can be added as they appear. view is easy to use but
somewhat complex to set up; the view "magic" file will have
to be customized to your specific system configuration.
See the View.doc file for details.
tee command added
The tee command simply copies its standard input to its
standard output and also to any files named in the argument
list. It normally overwrites the files, but can also
append. See the documentation on the tee command for
details.
SKsh Amiga Shell Page 7 Addendum to 1.4
crc command added
crc is a small utility which computes several 32 bit codes
based upon a file's contents. This is often useful to
check the integrity of data moved across a questionable
transmission medium.
du command added
The du command prints disk usage information for a set of
directory subtrees. It is similar in operation to the Un*x
command of the same name, although it is more flexible.
See the documentation for details.
cp now an external command
The cp command is now an external binary, not a shell
builtin as in SKsh 1.3. This was done both to improve the
speed of the cp command and to reduce the size of the SKsh
binary so that new functions could be added.
Update option added to cp
The cp command now supports an update option (-u) which
will copy source files to destination files only if the
source file is newer or the destination file does not
exist.
Clone option changed for cp
cp previously required the '-c' option if a clone copy was
to be made. This is now the default; the '-n' option can
be used to turn this behaviour off.
cp bugs fixed
A few bugs in the cp command were fixed. For example, cp -
r used to complain if the destination directory existed.
It no longer does this.
LLMIN variable added
LLMIN filters lines which are added to the history list;
any line which is shorter than LLMIN characters long will
not be added unless the 'h' options is set.
SKsh Amiga Shell Page 8 Addendum to 1.4
MAXDIST variable added
The MAXDIST variable also controls the history list. When
a line is entered from the keyboard (whether it has been
edited or not), SKsh will search backwards through the
history list for one just like it. If a line is found in
the last MAXDIST commands, the new one is not entered into
the history list (unless the 'h' option is set). If the
line is not found, or is found greater than MAXDIST
commands away, it is re-entered. This prevents commonly
used commands from disappearing off the beginning of the
history list.
Exit performance improved
SKsh previously took a few seconds to exit; this has been
improved, and it now exits nearly instantly.
Filename expansion bug fixed
There was previously a bug in the command line filename
expansion code which changed a leading '..' to a slash.
(For example, "../foo" would become "/foo"). This has been
fixed. In addition, a leading slash will no longer be
converted to a ':', although this did not cause any
problems.
An unrelated but similar bug was changing "..file" to
"/file", even though there was no slash between the ".."
and "file". This no longer happens.
ROOT variable added
If Un*x style filename mapping is enabled, SKsh now has the
ability to use a user-customized root. For example, if the
ROOT variable is set to ':' (as it is by default), a path
beginning with a slash will use the root of the current
device. If ROOT is set to 'dh0:', the filespec "/foo"
would specify a file called "foo" which was on the hard
drive, even if the current working directory was on a ram
or floppy disk. If ROOT is set to 'dh0:usr/src/' (the
trailing slash is important), path names will be relative
to that directory. Filename completion will work as
expected with the defined ROOT.
SKsh Amiga Shell Page 9 Addendum to 1.4
^d line editing bug fixed.
In previous versions of SKsh, a ^d which was used to delete
the last character in a line would cause "*** break" to be
printed when the next command was entered. This no longer
happens.
cat bug fixed
The SKsh 1.3 cat command would not print the last line of a
file if that line had no trailing newline character. This
has been fixed.
Stack requirements downgraded to 10k bytes.
The minimum permitted stack size has been downgraded from
16K to 10K bytes. It may be reduced again in future
versions. The previous 16K size was mostly due to an over-
zealous requirement. It is possible, but very unlikely,
that the 10K size will be exceeded; if this should happen,
simply increase the size. It should not be a problem for
most users.
Additional error code added
SKsh now has two error codes for programs which cannot be
executed. "Command not found" is reported if the command
cannot be located in the search path. If a file of the
same name is found, but it cannot be executed, then "Unable
to execute program" is reported.
Function key text now appended to line
Text inserted from a function key is now appended to the
end of the command line instead of replacing the old
command line. This is often more useful.
LASTRC variable added
A LASTRC variable has been added which is similar to the
existing $? variable. $? contains the return code from the
last command, whether that command was external or internal
(such as a echo statement or while loop). $LASTRC contains
the return code from the last external command; it is not
reset by internal return codes.
Also, one point about return codes may not be clear; even
complex statement have a return code. For example, the
return code from an "if" statement is the return code from
SKsh Amiga Shell Page 10 Addendum to 1.4
the last statement executed inside the "if". This can
occasionally be useful. The same applies for all other
shell constructs.
Lattice date functions no longer used
SKsh 1.3 used the Lattice date functions to display the
date and time for files and directories. However, the
Lattice functions contained a bug which often caused the
day to be off by one. SKsh 1.4 does not use the Lattice
date functions, so this bug no longer appears.
Documentation updates
As always, I have tried to keep the UserMan.doc and
Reference.doc documents up to date with the latest changes
and additions. A new View.Doc file has been added which
documents the view command, and the TinySKsh.doc file
describes tiny_sksh.
New Files
A sample view.magic file has been included which can be
used with the view command. However, it will have to be
modified to suit your specific system configuration (for
example, it must be told about which program you wish to
use to view IFF bitmap files). See the View.doc file for
details.
SKsh binary size reduced
I did some tuning of the SKsh code which reduced the size
of the binary by about 10K. The new SKsh 1.4 features take
about 5K of this, making the SKsh 1.4 binary about 5K
smaller than the 1.3 binary.
Notes
I am now distributing the SKsh archive in both zoo and lharc
format. The zoo files are easier to deal with in Un*x, while
lharc provides better compression.
I have modified the copyright notice in the UserMan.doc file
to cover several new cases including uploading SKsh to pay-
for-use computer systems (which is basically allowed except if
that system tries to claim any rights over SKsh), and
magazine/disk services which package PD or shareware software
and sell it, often with a magazine (which is basically *not*
allowed except under unusual circumstances). Please re-read
SKsh Amiga Shell Page 11 Addendum to 1.4
the copyright notice if you think any of these cases might
apply to you. Also, note that I make a distinction between
the magazine/disk services and PD/shareware disk collections
such as the one compiled by Fred Fish. I place much harsher
restrictions on the magazine/disk services.
SKsh 1.4 includes an extremely non-robust implementation of
"real" pipes using the '|' shell syntax. It is turned off by
default (and the old method is used). The non-robustness is
due exclusively to the two different AmigaDos I/O methods (see
the Addendum1.3.doc file for a small discussion of this). If
you wish to play with the real pipes, read the readme.pipe
file included with this distribution. However, please
understand that there are several problems, and this feature
is not yet intended for normal use.
I had told several people that the arp.library would be
distributed with SKsh 1.4. However, upon examining the arp
distribution notice, I discovered that this is not practical.
The entire arp archive must be included unmodified, and I must
place restrictions on the distribution of any SKsh archives
which contain the arp archive. I must also register the
location of all sites having SKsh with arp. For these (and a
few other) reasons, I opted not to include the arp.library
here.
I would again like to thank everyone who responded with ideas,
suggestions, and bug reports. While I could not, of course,
implement them all, I have made a reasonable dent in the list.
This feedback continues to be an important source of
improvements. I would also like to thank Fred Fish, who
maintains a compilation of freely distributable Amiga
software, and Tad Guy, who modederates the comp.binaries.amiga
usenet group through which SKsh is distributed.
SKsh Amiga Shell Page 12 Addendum to 1.4