home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d457
/
line
/
line.man
< prev
next >
Wrap
Text File
|
1991-02-14
|
13KB
|
331 lines
LINE(1) USER COMMANDS LINE(1)
NAME
line - a shell with features reminiscent of csh
SYNOPSIS
line [-a <maxaliases>] [-c <histsize>] [-d <dirstack>]
[-f <ignorelist>] [-p <prompt>] [-s <startup>]
[-t <tmpdir>]
line -h[elp]
DESCRIPTION
3mline 0mis a command interpreter meant to augment the regular
CLI environment with aliasing, history, file completion, and
some built-in commands. The result is a quite useable
subset of 3mcsh 0mfeatures, in under 20k.
OPTIONS
Parameters may be given to 3mline 0mfrom the command line and/or
the environment variable LINEOPTS (see ENVIRONMENT, below).
Values given for a parameter on the command line supercede
any for that parameter in LINEOPTS.
All options which require additional arguments will first
look at the text immediately following the option, and if
the needed parameter is not found, will take the next
argument. Upshot: as an example, both "-ablarg" and
"-a blarg" are valid syntax.
-a 3mmaxaliases
0mThe maximum number of aliases that can exist during the
session. Space for aliases is allocated dynamically.
Defaults to 20.
-c 3mhistsize
0mDefines the size of the history cache. A full
line-length buffer is allocated for each of these.
Default is 20.
-d 3mdirstack
0mThe depth of the directory stack used by push, pop, and
dirs. One longword is used per entry. Default is 5.
-f 3mignorelist
0mGives filename suffixes to ignore when doing filename
completion. A list of suffixes can be given by
separating the suffixes by vertical bars (note no
whitespace is allowed around the vertical bar). The
default is ""; a more useful one is ".o|~|.info".
-h[elp]
Prints short synopsis of command line options.
-p 3mprompt
0mSets the user prompt for the session. The default is
"%N> ". The various per cent codes that have special
meaning for the prompt are described in PROMPT, below.
-1-
LINE(1) USER COMMANDS LINE(1)
-s 3mstartup
0mThe startup file 3mline 0mlooks for commands in. It
defaults to "s:.linerc". This file can contain any
command that you would normally enter at the user
prompt, and comments may be added by putting a hash
mark ("#") as the first non-whitespace character of a
line.
-t 3mtmpdir
0mThe directory temporary files (such as those used to
implement pipes) are stored in. Defaults to "tmp:". It
is sufficient to assign tmp: instead, usually to ram:.
USAGE
Aliasing
A list of aliases is maintained that can be created,
modified, or destroyed with the "alias" and "unalias"
builtins. Aliases associate a string with a word. Whenever
that word is the first one in a command, the string is
substituted for it, and the line is re-evaluated. There are
some special character combinations that can occur in the
strings: "!'" will be replaced by a quotation mark (handy,
since many times alias strings will need to be quoted
themselves), and "!*", which puts any arguments following
the alias in at that particular spot, instead of appending
them. Multiple "!'" and "!*" are allowed.
Aliases may include other aliases within their definitions,
but cycles or loops are not permitted.
Command Line Parsing
Input lines are first broken up into commands at pipe
symbols ("|") and command seperators (";"). Note that "|"
and ";" must be surrounded by space(s); this restriction
imposed largely because the vertical bar is a valid
character in AmigaDOS wildcards. The resulting line then
has I/O redirection removed ("< file" and "> file" -- space
is optional between the redirection symbol and the
filename), and inconsistencies are checked for. For
example, both output redirection and a pipe to the next
command are illegal. Null commands are not allowed.
Then, history substitution is performed on the first word in
each command. For each substitution, the entire line is
re-evaluated from the beginning. Alias expansion is then
attempted on the first word in each command. Every
successful expansion will also cause the line to be
re-evaluated, WITHOUT HISTORY SUBSTITUTION.
Lastly, each command is checked to see if it is a built-in
function, and if so, it is executed. Note built-in commands
like "cls" may be over-ridden by capitalizing all or part of
the word: "Cls" is not a built-in command.
Finally, the commands are executed using ARP's SyncRun().
Editing Keys
^I Filename completion.
-2-
LINE(1) USER COMMANDS LINE(1)
^J Accept input line.
^M Same as ^J.
^Q Quits from line. See also the "exit" builtin.
^U Erases the current input line.
^X Same as ^U.
^W Erases the previous word.
Filename Completion
Pressing ^I will engage filename completion. 3mline 0mwill
attempt to match a partially typed (or even non-existent)
filename with one in the directory. The case of a match
will be changed to reflect that of the actual filename. If
an unambiguous match cannot be made, the longest possible
unambiguous part will be returned. Filenames with certain
suffixes can be ignored; see the description of the "-f"
command line argument for details.
History Substitution
A history of commands is maintained by 3mline 0mup to a limit
set by the "-c" command line argument (default 20). The
history mechanism allows these to be referenced on the
current command line. The first word of every command is
examined, and if it is one of several forms, the appropriate
substitution is made, any arguments following the history
reference are appended to the new command, and the line is
re-evaluated. The history forms are:
!!
Refers to the previous command. Any text in the word
following this is appended to the substituted command.
!n
Refers to command number 3mn. 0mAny text following the
number is appended to the substituted command.
!-n
Refers to the current command line minus 3mn. 0mAs before,
text following the number is appended. "!-1" and "!!"
are equivalent forms.
!str
Refers to the last command line containing 3mstr.
0m^m^n
Refers to the last command line, but with all
occurances of 3mm 0mreplaced with 3mn. n 0mmay be the null
string, in which case all occurances of 3mm 0mare deleted.
Optionally, this form may be followed by a carat. The
carat is ignored, but any text in the word following
the carat is appended to the substituted command.
The "history" builtin may be used to display the current
contents of the history cache.
I/O Redirection
3mline 0msupports the redirection of standard input and standard
output, as well as a command pipeline facility.
-3-
LINE(1) USER COMMANDS LINE(1)
< 3mfile
0mTake input for the command from 3mfile. 0mThe space is
optional after the "<". Input re-direction may occur at
any position after the first word of a command.
> 3mfile
0mRedirect the standard output of the command to 3mfile.
0mIf the file does not exist, it is created; if it
exists, its former contents are overwritten. As for
input redirection, the space between the ">" and the
filename is optional, and it may be placed at any place
except for the first word of a command.
BUILT-IN COMMANDS
alias
alias <name>
alias <name> <string>
The first form prints a list of all the aliases
currently known to the shell. The second prints out
the definition of a particular alias. The last creates
a new alias or changes the definition of an old one.
See USAGE for details on aliases.
cls
Clears the screen.
dirs
Prints the contents of the directory stack. The first
name printed is at the top of the stack.
exit
Exits from 3mline.
0mhistory
Prints the contents of the history cache.
pop
Makes the top entry in the directory stack the current
working directory.
push
Pushes the current working directory onto the directory
stack.
unalias [<name> ...]
Removes aliases from the alias list.
ver
Prints the version number and author of 3mline. 0mUse it
now. Use it often.
PROMPT
In addition to regular characters, the prompt may contain
any of the following special codes:
%b The basename of the current working directory.
%c The current command number.
-4-
LINE(1) USER COMMANDS LINE(1)
%e The ASCII escape character.
%h The ASCII backspace character.
%i The ASCII tab character.
%n The ASCII newline character.
%p The full pathname of the current working directory.
%N The CLI number.
Any unrecognised escapes (including "%%") expand to the
escaped character.
ENVIRONMENT
As opposed to typing them at the command line, arguments to
3mline 0mmay be placed in the environment variable LINEOPTS
(ARP's GetEnv() routine is used to get the variable; while
it recognises Manx-style environment variables, it is
recommended that Commodore's ENV: be used for future
compatibility). LINEOPTS is filtered through ARP's GADS as
well, so any features inherent to it can be used.
A problem arises regarding how to place the quote character
into an environment variable. It can be put there by
escaping it with an asterisk ("*"). For example, my
3mStartup-Sequence 0mincludes the line:
setenv LINEOPTS "-p *"%c %b >*" -f *".o|~|.info*""
AUTHOR
John Aycock, 1990. See copyright notice for restrictions.
FILES/DEVICES
s:.linerc Default startup file.
tmp: Directory for temporary files.
BUGS
Shell scripts should be executed somehow. Running 3mExecute
0mdoesn't seem to work at all.
The number of arguments in an environment variable is
limited to 20.
Crash and burn will occur in history substitution and alias
expansion near the ends of long lines (256 bytes). If your
lines are this long, you probably deserve to crash.
Pathnames (as printed by the %p prompt option or dirs)
cannot be longer than 256 bytes, or a visit from the GURU
will result.
-5-