home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
dirs
/
sksh_381.lzh
/
SKsh
/
Hints.doc
< prev
next >
Wrap
Text File
|
1990-10-20
|
8KB
|
331 lines
Hints and Tips for
SKsh
A ksh-like Shell for the Amiga
Version 1.6
(Copyright) 1989, 1990
Steve Koren
October 4, 1990
Making SKsh Resident
SKsh version 1.1 or later can be made resident. Add a line
like this to your startup-sequence:
c:resident sksh
where 'sksh' is the path to the sksh command itself. Then,
when SKsh is run through a shell-window, the resident SKsh
will be used, not the disk-based SKsh.
Starting SKsh with 'newcli' or 'newshell'
The 'newcli' or 'newshell' commands can be made to automati-
cally start SKsh when a new CLI window is generated. There
are two things that need to be done for this. First, define
an alias like this:
alias newcli='$(which newshell) CON:0/0/640/200/SKsh_Window'
Also, you must create a s:Shell-Startup file which runs SKsh.
Mine looks like this:
Prompt "%N.%S> "
sys:bin/setfont source 10 window
stack 6000
sksh
You may have to change this if you do not have the 'setfont'
command or do not have it installed in 'sys:bin'. The 'new-
cli' command will now start up a new window, with the given
size, and run SKsh for you automatically using the resident
'SKsh'. To make the 'exit' command in SKsh destroy the window
when SKsh exits, put the following in your .skshrc file:
LOGOUT='endcli'
Now, the 'newcli' alias can be used transparently with SKsh.
A similar mechanism can be used with MachII or other utilities
which let you define a hotkey which will create a new shell
window. Simply replace "newcli" with:
c:newshell CON:0/0/600/180/SKsh_Window
SKsh Amiga Shell Page 2 Hints and Tips
Setting up a man-page Directory
To set up a man-page directory, create one in a suitable
place, and assign the MAN: device to point to it in your
startup-sequence, like this:
assign MAN: sys:usr/man
The following function can be used to show man-pages:
function man {
if [ ! -f "MAN:$1.MAN" ]
then
echo "No manual entry for $1"
else
more "MAN:$1.MAN"
fi
}
(You can also remove the function begin and end lines and use
it as a script with the 's' bit set). Many public domain pro-
grams come with a "README" or .DOC file which explains how to
use the program. Copy these into the MAN: directory and re-
name them to prog.MAN. Then, you can use:
man prog
to display the documentation file. This is a simple example,
but it could be extended to, for example, uncompress com-
pressed files before viewing for prog.MAN and prog.MAN.Z. You
could also extend it to use a pager defined by a $PAGER
variable. Just replace 'more' with $PAGER.
Forcing execution as a program
The 'force' keyword will only force execution as a builtin,
alias, or function. To force execution as an external pro-
gram, simply use:
$(which prog) args
SKsh Amiga Shell Page 3 Hints and Tips
Re-sourcing the .skshinit file
If you source the .skshinit file after you start SKsh, any op-
tions you have set in your .skshrc file will potentially be
overridden. One example of this is the 'e' option. The
.skshinit file sets it, which disables command line editing.
It is reset in the .skshrc file. If you source the .skshinit
file again without sourcing the .skshrc file, you will have to
reset this option flag manually.
Using ^r for reverse searches
The SKsh usage of ^r for reverse searches is different than
the ksh usage. In ksh, you type ^r, which is echoed, the text
you wish to search for, and then return. In SKsh, you type
the text you wish to search for, followed by ^r. I have found
this usage more convienent.
Changing default command options
To change the default command options for a particular com-
mand, define an alias of the same name which uses the 'force'
keyword. For example, to change the 'rm' command so that it
echoes file names as they are deleted, put the following alias
in your .skshrc file:
alias rm = 'force -b rm -v'
File name completion hints
The <esc>= command can be used to list all file names in a
given directory. If the previous word ends in a slash, <esc>=
will list each file in the directory:
[dh0:]: more ram:test/
(press <esc>=)
1) ram:test/file1.txt
2) ram:test/file2.txt
3) ram:test/my_file.txt
SKsh Amiga Shell Page 4 Hints and Tips
Maximum command line length
Command lines which are passed to external functions are
limited in length by AmigaDos to 255 characters. Alias
substitions are limited in length by SKsh to 1023 characters;
lines longer than that will generate a syntax error. However,
SKsh builtins can operate on any number of arguments.
Therefore, a "dir foo:*" might generate a syntax error if a
very large number of files are matched. In these cases (which
should be rare) the builtin form of the alias (in this case,
"ls") will operate correctly since there are no length
limitations.
Bypassing Internal Commands
If a name is interpreted by SKsh as a builtin, alias, or
function, but is also an external command, starting the name
with a capital letter will force SKsh to use the external
command. SKsh internal commands are case sensitive, while
external binaries are not. For example, using a lower case
"dir" normally invokes the SKsh alias of that name. However,
using "Dir" will invoke the AmigaDos command provided that it
is in your search path. The builtin form of the command can
also be unaliased or unset.
Making Commands Resident
There are several different resident command standards avail-
able under AmigaDos. SKsh uses the ARP method, and will "see"
resident commands added to that list (which the SKsh resident
command will do). If commands are added to another resident
list, SKsh will use the disk based form of the command.
SKsh Amiga Shell Page 5 Hints and Tips