@NODE UtilStart "Starting from Hotkey-Utilities or Directory-Utilities"
In most cases you have to use a template like @{" starting from CLI " Link CLIStart}
when configuring the utility.
If the utility does not open a window, you have to use the "-w" option.
If the utility seems to hang up after starting ZShell, try the "-d" option.
With "-d" you do not need a "-w" option.
Example: zshell -wCON:1/10/640/100/ZShell -d
Some special programs:
YAK: Use "zshell -d" as argument of a hotkey-definition.
MachV: EXECMD"zshell -d"
MTool: Define a program with "zshell" as program and "-d" as parameters.
@ENDNODE
@NODE StartingCON "Starting ZShell using KingCON"
KingCON is a Console-Handler with some GUI-Features.
If you do not use KingCON, you can skip this chapter.
Starting from CLI/Shell:
Use the option -n, and you can optionally use option -w.
Examples: ZShell -n
ZShell -wKCON: -n
Starting from Workbench:
Use the ToolTypes NORAW and WINDOW=KCON:
The CLI-Option "-n" and the ToolType "NORAW" switch off the internal
command-line-editor, so you could make use of the command-line-
editing facilities of KingCON.
@ENDNODE
@NODE Conuse "How to use CON:"
CON: stands for Console-Handler. This is a program which handles
keypresses and textual outputs on its window similar to a file.
You have to pass several things when opening a CON: window:
CON:leftpos/upperpos/width/height/title
leftpos,upperpos are the position of the left top edge in pixels.
Both need to be 1 or more.
width,height are the window's dimensions in pixels.
title is a string
With OS2.0+ you can pass some more things and you can drop some things.
So "CON:" alone is valid and opens with the default settings.
To get a close gadget you have to append "/CLOSE", eg.
CON:1/1/600/100/Great/CLOSE
"/SCREEN screenname" opens on a public screen
"/WAIT" stays till you click the close gadget or press CTRL-\
"/ALT" gives an alternative size with the zoom gadget
... there are some more but I do not know much of them
@ENDNODE
@NODE ErrorStart "Errors during starting"
If there is an error during starting, a recoverable alert will appear
and show a number. Here is a list what these numbers mean:
Workbench-Start:
1: No memory for CLI-Structure
2: CLI-Table 20 limit
3: No current directory
4: No icon.library
5: No icon
OpenWindow:
10: Already opened
11: Cannot open output
12: Not interactive
13: Cannot open input
Newcli:
15: Cannot copy CurrentDir
16: Cannot set up pipe process
Input:
20: Input failed
21: Unexpected window closure (harmless)
22: Forbid or Disable state (bug in external command)
@ENDNODE
@NODE Notes "Several notes"
* You can start ZShell from within the Startup-Sequence. After ending
ZShell the Startup-Sequence will continue. If you use "ZShell -d" in
the Startup-Sequence, it will continue and a ZShell will pop up.
* If you would like a scrollbar, try CB (ConBuffer) from
Aminet/util/shell/conbuffer11.lha . A bit old, but it works.
* You can rename "ZSH" as what you like, but do not rename "ZShell"
* If you start ZShell from the Workbench-Menu "Execute Command",
you can close the window after ending ZShell with CTRL-\ or
doubleclick the close-gadget.
* ZShell and ZSH are PURE (see @{" RESIDENT " Link RESIDENT},@{" PROTECT " Link PROTECT}).
@ENDNODE
@NODE History "History and Command Line Editing"
ZShell has a 1024 byte circular history buffer. It works similar
to most other shells, the NEWCON: handler in Workbench V1.3 and
the standard console handler in OS2.0+.
You can change the edit keys with @{" CONFIG CTRLKEYS " Link CTRL}.
These are the default keys:
UP ARROW - go back one line in the history buffer
DOWN ARROW - go forward one line in the history buffer
SHIFT UP ARROW - go to the 1st line in the history buffer if nothing
was typed. Otherwise the string left of the cursor
will be searched in history buffer (like in OS2.0+)
SHIFT DOWN ARROW- go to the last line in the history buffer, which
holds the last modified line
This is some kind of undo.
LEFT ARROW - move cursor left
RIGHT ARROW - move cursor right
SHIFT LEFT ARROW- move cursor to left end
SHIFT RIGHT ARROW move cursor to right end
CTRL R - move cursor to start of previous word
CTRL T - move cursor to start of next word
CTRL S - delete to start of line
CTRL E - delete to end of line
CTRL W - delete one word right of cursor
CTRL Q - delete one word left of cursor
CTRL X - delete whole line
TAB - see @{" FILENAME COMPLETION " Link FILENAMECOMPLETION} (that is great !)
SHIFT TAB - read @{" review-buffer " Link review} with @{" MORE " Link MORE}
CTRL V - read history-buffer with @{" MORE " Link MORE}
CTRL F - pop up a filerequester (needs asl.library)
See @{" FILENAME COMPLETION " Link FILENAMECOMPLETION} for more.
CTRL L - clear the ZShell window
CTRL P - clear the Filename completion buffer. This is useful
with CrossDOS, because it does not notice changes.
RETURN - put commandline in history-buffer and execute it
SHIFT RETURN - put commandline in history-buffer without executing
ESC (Escape) - quit ZShell like @{" ENDCLI " Link ENDCLI} (I like this very much !)
Words are delimited by space, point, slash and colon ( ./:).
Again, command line editing is similar to most shells. Backspace,
delete and return do what they are supposed to do.
If you have defined (using @{" ALIAS " Link Alias}) some Function keys,
you can use them, too.
OS2.0+:
You can drop Workbench-Icons into the ZShell's window. Then the name of
the icon will be inserted into the commandline.
When in @{" iconifyed " Link Flags 20} mode, you can drop an icon on that
Application-Icon with the same effect.
@ENDNODE
@NODE Parser "Command Line Parser"
After entering a command line and pressing RETURN, it will be analyzed.
Characters that have a special meaning:
; separates multiple commands
| separates multiple commands with @{" piping " link pipes} output/input
> output @{" redirection " link redirect}
< input @{" redirection " link redirect}
" quote
If you want to use one of these characters in a normal way, like in a
filename, you have to precede it by \ or you have to enclose the whole
argument in quotes. If you want to have a \ before these special
characters, you have to type \\ .
Example: a\;b\\|c\<d
This will be converted to a;b\|c<d
The ; is for multiple commands in one command line. Example:
dir ram:;info;echo Done^J
Quotes can be used to surround arguments. Inside the quotes no parsing
is done. This way you can have arguments which contain spaces. Every
opening quote must be followed by a closing quote. Example:
dir "ram disk:"
echo "one; two; three"
@ENDNODE
@NODE Executing "Executing Commands"
Most commands can be aborted by depressing Control-C.
Nearly everything is case independent.
To use a disk command simply type its name after the prompt, the
same way as you would do in other shells. The first part of the input
up to the first space is interpreted as commandname. It is searched
for (in this order) :
1. in the @{" alias " Link alias} list
2. in the internal (builtin) command list (see @{" COMMAND OVERVIEW " Link Index})
3. in the @{" resident " Link resident} command list
4. in the current directory (see @{" CD " Link CD})
5. in the @{" command search path " Link path}
and, if it is found, it is executed. The part after the first space
is taken as arguments, also called parameters. The arguments are
separated by spaces. ZShell will allow up to 25 arguments.
If the commandname was found on disk, it will be analyzed:
1. If the commandname is a directory, the current directory will be
changed (see @{" CD " Link CD}) to it.
2. If the script flag is set, it will be @{" executed " Link Execute} eighter
as ZShell script or as ARexx script.
3. If the execute flag is set (and it is set in most cases), it will be
tried to treat it as normal executable command.
4. If the command is not executable, it will be shown using
@{" amigaguide.library " Link Guide.lib} (This is an easy way to view Guides).
eg. addbuffers df0: 15
"addbuffers" is the command, that will be found as a internal command.
"df0:" is the first argument. "15" is the second argument. The third
argument does not exist.
You can avoid using an @{" alias " Link alias} or an internal (builtin) command or
changing the current directory by typing a point before the
commandname (this is called "force disk").
To abbreviate internal or @{" resident " Link resident} commands put a point behind it.
If you use just a point, the current directory will be set to the
last current directory ("dir back").
To get to the parent directory, you have to use a slash ( / ).
eg. .addbuffers df0: 20
{This uses the disk command or if available the resident addbuffers}
ad. df0: 20 {uses the internal addbuffers command}
.add. df0: 20 {if available this uses the resident addbuffers}
. {go back to old current dir}
BEWARE of other matching commands! The first matching will be taken!
"as." can mean ASK or ASSIGN, but ASK will be taken !
There is no abbreviation for disk commands, use @{" Filename Completion " Link FileNameCompletion}
( TAB-Key ) instead.
A textual error message will be displayed if an AmigaDOS error occurs.
@ENDNODE
@NODE Guide.lib "amigaguide.library"
For those who do not know:
amigaguide.library is Commodore's great hypertext system that can
easily be used to view documentations or to implement online-help into
own applications.
It needs Kickstart 1.3 or better.
You can get it from Fish Disk 920 or from Aminet as text/hyper/aguide34.lha
amigaguide.library V34+ can show AmigaGuide documents and ASCII documents.
V39+ that comes with OS3.0+, can show all kinds of files that are supported
by your datatypes including AmigaGuide and ASCII texts.
So, with OS3.0+, you can enter the name of a picture in ZShell just like
a command to view it.
@ENDNODE
@NODE Numbers "Using Numbers"
Various internal commands need numbers as arguments. Usually you simply
give a decimal number, but you also can use these prefixes:
+ Positive number
- Negative number
% Binary number
$ Hexadecimal number
& Hexadecimal APTR converted to BPTR
! Hexadecimal BPTR converted to APTR
^ Filename containing number
See @{" EVAL " link Eval} for more.
@ENDNODE
@NODE Wild_Card "Wild Cards"
ZShell supports wild card file descriptions on some commands
(@{" DIR " Link DIR},@{" LIST " Link LIST},@{" DELETE " Link DELETE},@{" COPY " Link COPY},@{" CONFIG " Link CTRL},@{" JOIN " Link JOIN},@{" MOVE " Link MOVE},@{" PROTECT " Link PROTECT})
Important: If you want to use | as part of a wild card, you have to
precede it by \ or enclose the wild card by quotes. This is to avoid
to be treated as an @{" pipe " link pipes}. Example:
dir ram:(*.info\|*.bak)
or dir "ram:(*.info|*.bak)"
instead of dir ram:(*.info|*.bak)
OS2.0+ note: The default is to use AmigaDOS wildcard patternmatching.
It is localized and has not the limitations of the internal matcher.
But you have to be careful when looking at the examples in this
documentation, because they are made for the internal matcher.
(You can even use * instead of #? with the AmigaDOS matcher, because the
wildstar flag is set by ZShell in the system for all programs. Please
tell @{" me " link Authors 9} if this makes problems.)
To switch back to the internal matcher use: @{" FLAGS WILD OFF " link Flags}
AmigaDOS patternmatcher:
? Matches a single character.
# Matches the following expression 0 or more times.
(ab|cd) Matches any one of the items seperated by '|'.
~ Negates the following expression. It matches all strings
that do not match the expression (aka ~(foo) matches all
strings that are not exactly "foo").
[abc] Character class: matches any of the characters in the class.
[~bc] Character class: matches any of the characters not in the
class.
a-z Character range (only within character classes).
% Matches 0 characters always (useful in "(foo|bar|%)").
* Synonym for "#?", not available by default in OS2.0,
but is switched on by ZShell.
"Expression" in the above table means either a single character
(ex: "#?"), or an alternation (ex: "#(ab|cd|ef)"), or a character
class (ex: "#[a-zA-Z]").
The following refers to the internal patternmatcher:
Wild cards are like those supported on MessyDOS or UNICS systems, and not
the same as the ones on AmigaDOS. So use * instead of #? .
NOTE: You can only effectively put one * character in a wild card.
Character Meaning
* Match zero or more characters.
? Match one character.
~ Negates the following wildcard.
[ ] Specifies a class of characters to match.
(One of the characters in the brackets must match)
| Separate multiple filenames (can be wildcards)
(One of the file descriptions separated by | must match)
To get that just try the examples following and try it out with @{" DIR " Link DIR}.
eg. list *.info {lists all files ending in .info}
dir z*.s {lists all files starting z, ending in .s}
delete df0:*.info {deletes all .info files from df0:}
copy *.s ram: {copies all .s files to ram:}
copy 1? df0: {copies all two char files beginning with 1}
dir ~*.s {lists all files NOT ending in .s}
list ~*.info {lists all files except for .info files}
dir *.[co] {lists files ending in .c or .o}
list [abcd]* {lists files beginning with a,b,c or d}
list c:mount|version {lists the files Mount and Version}
{OS2.0+ this would be: list c:(mount|version) }
list ram:env/a*|*b {lists all files starting with a or
ending with b from RAM:env (environment)}
copy ~*.info|*.bak {copies all files NOT ending in .info
and NOT ending in .bak}
@ENDNODE
@NODE Option "Options"
As nearly everything, options are also case independent.
The internal commands support only four options, because this is
easier to remember. These options start with a dash (-) followed by
one character.
1. -C (means Clear) , used by @{" AVAIL " Link AVAIL},@{" ENDCLI " Link ENDCLI},@{" LOCATE " Link LOCATE},@{" PATH " Link PATH},@{" RESIDENT " Link RESIDENT}
2. -R (means Recursive) , used by @{" COPY " Link COPY},@{" DELETE " Link DELETE},@{" DIR " Link DIR},@{" LIST " Link LIST},@{" JOIN " Link JOIN},
@{" MOVE " Link MOVE},@{" PROTECT " Link PROTECT}
3. -Q (means Quick) , used by @{" DIR " Link DIR},@{" JOIN " Link JOIN},@{" LIST " Link LIST},@{" DELETE " Link DELETE}
4. -S (means Sort) , used by @{" COPY " Link COPY},@{" MOVE " Link MOVE},@{" PROTECT " Link PROTECT}
Instead of -R you could also use ALL , if @{" FLAGS ALL ON " Link Flags 49} is set.
For some special cases there are longer options used: "delete bla force"
FORCE is here an option. You can abbreviate this by a point
(see @{" CONFIG DOT " link CTRL}), so "delete bla f." is the same.
To avoid a filename, that is equal to an option, to be treated as an
option you have to surround it with quotes:
copy "-r" ram: {to copy the file -r to ram:}
delete "force" {to delete the file named force}
@ENDNODE
@NODE Redirect "Redirecting Input/Output"
The standard redirection operators are supported for all internal
commands, as well as disk based and resident programs. (Redirection only
affects those programs which use the dos.library's Input() and Output()
functions.)
>filename redirect std output
<filename redirect std input
>>filename append redirect output (tacks output onto the end of file)
<>filename redirect input and output, "filename" must be interactive
like CON:, NEWCON:, NIL: and AUX:
>M view output with @{" MORE " link MORE} after the command has ended,
you need a @{" review-buffer " link REVIEW} for that which is big enough,
otherwise some of the output will be swallowed.
<W >W <>W opens a window and inputs/outputs there.
<* >* <>* redirection to current window (rarely used)
If you do not give a filename, input/output will be redirected to NIL:
Redirection can be placed before, between and after arguments and has
the same effect for all three cases.
Note that @{" pipes " link Pipes} are some kind of redirection.
eg. dir >"ram disk:directory" df0:c
type zshell.doc <raw:0/0/100/100/input >raw:0/0/640/100/output
sortfile things >>df0:things.log
list >m df0: {view output with more}
copy > df0: ram: {redirects to NIL: , no output !}
type S:Startup-sequence >W {outputs on own window}
@ENDNODE
@NODE Pipes "Anonymous Pipes"
ZShell supports anonymous pipes with background tasks like those in UNICS
and with temporary files like those in Amiga-csh.
@{" General things about pipes " link GeneralPipes} What are pipes ?
@{" Real pipes " link RealPipes} The real thing.
@{" Pseudo pipes " link PseudoPipes} Are better in some cases.
@{" Filters " link Filters} Something to use pipes with.
@{" Notes " link PipeNotes} What else is interesting.
@ENDNODE
@NODE GeneralPipes "General things about Pipes"
Have you ever tried to view the output of a command with an external
text viewer ? Then you probably have tried something like:
List >T:listing -r dh0: ; MuchMore T:listing ; delete T:listing
(You do not need spaces before and after semicolons)
Using anonymous pipes you simply have to type:
List -r dh0: | MuchMore
The "|" character is the pipe symbol. This is why they are called
ANONYMOUS pipes: You do not have to specify a filename.
You can leave out the space before and after "|", I just included them
to make it looking better.
In the above example MuchMore stands RIGHT to the pipe symbol. This means
that it gets its input from the output of the command LEFT to the pipe
symbol. You can simulate this by "MuchMore <T:listing" instead of
"MuchMore T:listing".
Not every command supports reading its input from an input redirection,
so not every command can stand RIGHT to | . All commands can be placed
LEFT to | , but with those having no output it does not make sense.
You can use multiple | in one line like:
List -r dh0: | UUencode | MuchMore
The List command will pass its output to UUencode, this will modify the
data and outputs it to MuchMore which will display the modified output
of the List command.
Commands, like UUencode, which read data from input, modify it and
output the modified data are called @{" filters " link Filters}. They are usually used
RIGHT to or BETWEEN pipe symbols.
Using pipes and filters it is easy to process streams of data like: