[comp.sources.unix] v14i043: Mail User's Shell, version 6.0, Part11/14

rsalz@bbn.com (Rich Salz) (04/16/88)

Submitted-by: island!argv@sun.com (Dan Heller)
Posting-number: Volume 14, Issue 43
Archive-name: mush6.0/part11

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 11 (of 14)."
# Contents:  mush.1.a
# Wrapped by rsalz@fig.bbn.com on Wed Apr 13 20:04:54 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'mush.1.a' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mush.1.a'\"
else
echo shar: Extracting \"'mush.1.a'\" \(33606 characters\)
sed "s/^X//" >'mush.1.a' <<'END_OF_FILE'
X.\" Mush Man Page: Copyright (c) 1987 Dan Heller
X.\" Cleaned up January 1988 by Bart Schaefer <schaefer@cse.ogc.edu>
X.\"
X.if n .ds Q \&"
X.if n .ds U \&"
X.if t .ds Q \&``
X.if t .ds U \&''
X.if n .ds - --
X.if t .ds - \(em
X.nh
X.TH MUSH 1 "Dec 21, 1987"
X.UC 4
X.SH NAME
The Mail User's Shell \- Shell for electronic mail.
X.SH SYNOPSIS
X.B mush
X[
X.B \-n
X]
X[
X.B \-v
X]
X[
X.B \-s
subject
X]
X[
X.B \-c
cc-list
X]
X[ address-list ... ]
X.br
X.B mush
X[
X.B \-n
X]
X[
X.B \-i
X]
X[
X.B \-r
X]
X[
X.B \-C
X]
X[
X.B \-N
X]
X[
X.B \-S
X]
X[
X.B \-1
cmd_help
X]
X[
X.B \-d
X]
X[
X.B \-f
X[ folder ]
X]
X.br
X.B mush
X[
X.B \-n
X]
X[
X.B \-i
X]
X[
X.B \-r
X]
X[
X.B \-C
X]
X[
X.B \-N
X]
X[
X.B \-S
X]
X[
X.B \-1
cmd_help
X]
X[
X.B \-d
X]
X[
X.B \-u
X[ user ]
X]
X.br
X.B mush
X[
X.B \-n
X]
X[
X.B \-H[:c]
X]
X.br
X.B mush
X[
X.B \-n
X]
X[
X.B \-t
X]
X[
X.B \-T
timeout
X]
X[
X.B \-1
cmd_help
X]
X[
X.B \-2
tool_help
X]
X[
X.B \-d
X]
X[
X.B \-f
X[ folder ]
X]
X.br
X.B mush
X[
X.B \-n
X]
X[
X.B \-t
X]
X[
X.B \-T
timeout
X]
X[
X.B \-1
cmd_help
X]
X[
X.B \-2
tool_help
X]
X[
X.B \-d
X]
X[
X.B \-u
X[ user ]
X]
X.SH INTRODUCTION
The Mail User's Shell (Mush) is an interface for sending and manipulating
a database of electronic mail messages under the
X.I UNIX
environment.
There are three user interfaces which allow the user to interact with
X.I Mush.
The default interface is the conventional tty-based line mode
similar to command line interpreters such as
X.I csh
as well as other mailers, such as University of California, Berkeley's,
X.I Mail
and Bell Lab's System V
X.I mailx
interface.
This mode requires nothing from the terminal in screen
optimization and may be run on many different versions of the
X.I UNIX
operating system.
X.PP
The text-graphics (curses) interface is reminiscent of the
X.I vi
visual editor, but is user-configurable to simulate other editors.
This interface does not require graphics capabilities of
the computer or the terminal on which it is run, but the terminal must
have the minimum capabilities required by any visual screen editor.
X.PP
The
X.I window
interface for the Sun Workstation utilizes the icon and
menu based (mouse selectable) windowing system.
This
X.I tool
X(graphics), mode is highly subject to the version of operating system
your Sun may be running.
While the program works with variable levels of success on earlier versions, it
is intended to be run on Sun versions 2.0 and higher.
See the BUGS section at the end for more information.
X.PP
See the corresponding sections for more information on the user
interface desired.
Most of this manual deals with commands, variables
and actions which are common to all three interfaces although
some attention is paid to individual characteristics of each interface.
X.PP
The following command line arguments are understood by
X.I Mush:
X.TP
X\-C
Enter the mailer in curses mode upon startup.
X.TP
X\-c cc-list
The list of Carbon Copy recipients is set on the command line.
If more than one address is specified, the entire list should be encased in
quotes.
This applies when sending mail only.
If you are entering the shell, curses mode, or the tool mode, this option is
ignored.
X.TP
X\-d
Turns on the debugging level to 1.
You can change debugging levels from within the shell using the
X.B debug
command.
X.TP
X\-f [ filename ]
The optional filename argument specifies a folder containing mail messages.
With no argument,
X.B mbox
in the current directory (or the variable
X.BR mbox )
is used.
If no filename is given, this option must be last on the command line.
X.TP
X\-H[:c]
Have
X.I Mush
display mail headers without entering the shell.
See the
X.B headers
command for information on the
X.B :c
argument.
No colon modifier is equivalent to \*Q\-H:a\*U.
This option prevents the shell from running, so this option will turn off the
X\-S and \-C flags.
This option is ignored if the tool mode is in effect.
X.TP
X\-i
Forces interactive mode even if input has been redirected to the program.
This is intended for remote host mail sessions but also allows
the user to redirect \*Qscripts\*U of
X.I Mush
commands.
See the INITIALIZATION section for information on how to
write scripts which deal with mail.
Note that this flag is different from the \*Qignore\*U flag of UCB Mail.
X.TP
X\-N
Enter
X.I Mush
without displaying any message headers.
This argument is passed to the
X.B folder
command.
X.TP
X\-n
No initialization is done on start up.
That is, do not source
X.I .mushrc
or
X.I .mailrc
files.
See the INITIALIZATION section for more information on
startup and the significance of these files.
X.TP
X\-r
Initialize the folder in Read-Only mode; no modification of the folder is
permitted.
This argument is passed on to the
X.B folder
command.
X.TP
X\-S
This flag allows the user to enter the shell even if the system
mailbox or specified folder is empty or doesn't exist.
X.TP
X\-s subject
The subject is set on the command line using this flag.
If the subject has
any spaces or tabs, the entire subject should be encased in quotes.
This applies when sending mail only.
If you are entering the shell,
curses mode, or the tool mode, this option is ignored.
X.TP
X\-T timeout
In the tool mode (Sun only),
X.I timeout
specifies the length of time (seconds) to wait between each check for new mail.
X30 seconds is the smallest time allowed for performance reasons.
X60 seconds is the default value.
X.TP
X\-t
Use the graphics tool mode (Sun only).
X.TP
X\-u [ user ]
The mailbox to use is /usr/spool/mail/\fBuser\fR.
If the login name for user is not specified, then root is used.
X.TP
X\-v
Verbose mode is turned on.
This option is passed to the actual mail delivery
subsystem internal to your version of
X.I UNIX.
Some mailers do not have a verbose option, so this flag may not apply
to your system (System V, for example).
This applies when sending mail only.
If you are entering the shell,
curses mode, or the tool mode, this option is ignored.
X.TP
X\-1 cmd_help
X.ns
X.TP
X\-2 tool_help
X.rs
Specify alternate locations of help files.
These should be full pathnames accessible for reading.
This is usually done if a binary copy of
X.I Mush
has been copied from another machine and the wrong pathnames to the
help files cannot be changed.
X.SH FEATURES
X.BR "New Mail" .
X.PP
If during a
X.I Mush
session, new mail arrives for you, it is automatically incorporated into
your system mailbox and you are told that new mail has arrived.
X.PP
In the default line mode, new mail is checked between each command
issued.
In the curses mode, new mail is checked on each
command and is displayed in the bottom line of the screen.
In the tool based graphics mode, new mail is checked approximately
every minute or by the number of seconds specified by the
X.B -T
option on the command line.
X.PP
If you are using your system mailbox as your \*Qcurrent folder,\*U then the
new mail is added immediately to your current
list of messages and the following information is displayed, to tell you
whom the mail is from:
X.sp
X.ti +2
New mail: (#15) island!argv@sun.com (Dan Heller)
X.sp
If you are not in your system mailbox, then the new mail will not be added
to your list of messages, but you will instead be informed of the new arrival.
X.sp
If you are using the tool based mode and
X.I Mush
is closed to an iconic state, then the number of messages in the current
folder is displayed on the mailbox icon and the flag on the mailbox will go up.
X.PP
X.BR History .
X.PP
In the line-mode interface,
X.I Mush
supports a history mechanism similar to that supplied by
X.IR csh .
A subset of history modifiers are supported to reference previously
issued commands and to extract specified arguments from these commands.
X.PP
X.BR "Mail Aliases" .
X.PP
Mail aliases are shorthand names for long mail addresses.
These are supported in the same manner as UCB Mail supports them.
Because
X.I Mush
has command line history reminiscent of
X.IR csh ,
commands which use UUCP's `!' character for user-host and host-host
separation should be escaped (preceded by a backslash).
This is not necessary in the initialization file (.mushrc) because history
referencing is ignored while these files are being sourced.
See the INITIALIZATION and LINE-MODE INTERFACE sections for more
information on initialization file format and the history mechanism.
X.PP
Aliases reference normal mailing addresses as well as other aliases.
If a loop is detected, then the user will be notified and the message will
be forced into the file
X.B dead.letter
in the user's home directory.
The
X.B unalias
command is used to reverse the effects of the
X.B alias
command.
X.PP
X.BR "Command Line Aliases" .
X.PP
Command aliases are different than mail aliases in that they are used
to expand to commands.
The usage of command line aliases is similar to that supplied by
X.IR csh .
X.sp
X.PP
X.BR "Command Pipes" .
X.PP
X.I Mush
commands can be \*Qpiped\*U to one another so as to provide output of
one command to be used as input to the next command in the pipeline.
However, the output of commands is not the \*Qtext\*U that is returned
X(as it is in
X.IR csh ),
but the messages that are affected.
X.PP
X.BR Help .
X.PP
X.I Mush
was designed so that each command or action should not be a mystery.
Helping the user understand what to do and how to do whatever he wishes
is the goal behind the help facility.
For this reason, the
X.B help
command gives information on both general usage and specific help categories.
X.PP
In text mode, most help is gotten by typing \-? as an argument to a
command.
Virtually every command has the \-? option.
When this option is specified, most commands will attempt to read from a help
file the necessary information explaining the functionality of the command.
If necessary, a pointer to other sources of information will
be given to fully explain a concept.
X.PP
In the curses mode, the `?' key will display a list of the current
command-to-key bindings; a keystroke or set of keystrokes correspond
directly to a command.
X.PP
In the tool/graphics mode, this is
also available, but more extensive help is provided in the pop-up menus.
Pop-up menus can be gotten from virtually anywhere on the screen; press the
RIGHT mouse button (the \*Qmenu button\*U) and a number of items will appear
in a menu.
The last command in the menu list will be one labelled \*Qhelp\*U.
Selecting this menu item will display a \*Qhelp box\*U in the center of the
console and wait for input to remove the box.
X.PP
X.BR "Sorting mail" .
X.PP
X.I Mush
allows you to sort your mail according to various constraints such
as time, status (new, unread, deleted, etc), by author and subject.
See the
X.B sort
command in the COMMANDS section for more information on sorting.
X.PP
X.B Picking specific messages.
X.PP
You can select messages that contain unique information, or from
messages that have special attributes.
You have the option of restricting your search to messages between dates,
message numbers, author names and other constraints.
X.SH INITIALIZATION
After the command line arguments have been interpreted, if the argument
X.B -n
is not given,
X.B Mush
will read commands from an
X.B "initialization file"
that (typically) sets variable values, aliases, command line aliases,
and so forth.
The default system initialization file is read first and then the
user's personal initialization file is read.
The system default file
is set up by the system administrator and may contain commands which
should be set system-wide.
X.PP
The user's file is determined by first looking for the environment variable
X.IR MAILRC .
If that file isn't found, then the file
X.I .mushrc
is searched for in the home directory of the user.
If that file cannot be found, it will attempt to read the file,
X.I .mailrc
from the same directory.
Finally, if that file cannot be read, no initialization is done
and the default values will be in effect.
X.PP
If the user has no home directory, or permissions prevent read/write access
to $HOME, /tmp is used as the home directory.
See the
X.B home
variable under the VARIABLES section.
X.PP
Once in the shell, the
X.B source
command may be used to specify a file if you want to read commands from
a specific file other than the default.
The command
X.B saveopts
will save all variable settings, aliases, and all other
X.I Mush
settable attributes, to aid in creating an initialization file.
If no filename is given on the command line,
the
X.B source
and
X.B saveopts
commands choose a file in the manner described above.
X.B Saveopts
will not overwrite the file if it exists.
In such cases, you will be prompted to confirm overwrite.
If you confirm overwriting the existing file, remember that existing \*Qif\*U
expressions or other manually entered comments or non variable-setting type
commands that previously existed in the file will be lost.
X.PP
No interactive commands should be called from any initialization file.
These commands are not prevented because it is impossible to trace which
commands may be UNIX commands that are interactive.
The responsibility of not running interactive commands is left to the user.
Because the initialization file is read
X.I before
any messages are read into the program,
message filtering commands should not be placed in this file unless you know
you're going to
X.IB re- source
the file later as a command.
X.PP
X.IR "Initialization File Format" .
When reading the initialization file,
X.I Mush
will recognize the `#' character as a comment character.
It may be anywhere on a line in the file.
When that character is encountered,
processing of that line is discontinued to the end of the line.
If the `#' is encased in quotes (single or double), then it is not
considered a comment.
Examples:
X.sp
X.ti +2
set shell = /bin/csh  # set the shell variable
X.ti +2
X# this entire line has been commented out.
X.ti +2
set prompt = "Message #%m: "  # The `#' is within quotes
X.PP
The
X.B exit
command has special meaning in the initialization file.
If the command is found,
X.I Mush
will not exit, but rather, discontinue reading from the file immediately.
X.PP
There may be \*Qif\*U expressions within the initialization file to determine
certain runtime states of
X.I Mush.
There are no parentheses allowed and only one boolean expression may be
evaluated per line; that is, no \*Q&&\*U or \*Q||\*U may be used in
expressions.
There is currently no support for multiple levels of if-else expressions
and embedded \*Qif\*U expressions are ignored (they are evaluated to TRUE).
There must always be an \*Qendif\*U matching each \*Qif\*U expression.
The statements associated with an \*Qif\*U expression are never on the same
line with the conditional.
X.PP
Conditional expressions understood include the internal variables,
X.IR istool ,
X.IR iscurses ,
X.IR hdrs_only ,
X.IR is_sending ,
and
X.IR redirect .
If
X.I istool
is true, the program is going to run in the tool mode.
If
X.I iscurses
is true, the program is in or is going to run in the curses mode even
though the screen package may not yet have been started.
If
X.I hdrs_only
is true, then the -H flag on the command line has been given.
If
X.I is_sending
is true, then the user is sending mail to a user.
This does not imply
that the user is not going to be running a shell after the mail is sent.
If
X.I redirect
is true, then input to the program is redirected.
The test for redirection tells whether input, not output, has been
redirected to the program.
The
X.B \-i
option on the command line is required to run the shell if redirect is on.
If \-i is specified, the value for
X.I redirect
will be set to false.
These are internal variables whose values can not be referenced using the
X\*Q$variable\*U method of variable expansion.
X.PP
The `!' operator may be used to negate expressions, thus,
X.sp
X.nf
X.in +2
if !istool
X.ti +4
exit
else
X.ti +4
set autoprint
endif
X.in -2
X.fi
X.sp
means that if you are not running as a tool, stop reading commands from this
file.
Otherwise, set the autoprint variable.
X.sp
X.in +2
X.nf
set hdr_format = "%25f %7d (%l/%c) %25s"
if hdrs_only
X.ti +4
exit
endif
X.in -2
X.fi
X.sp
This tells the program to set the hdr_format variable and check to see if
we're running the program to read headers only.
If so, stop reading this file (exit) and continue on with the program.
This speeds up runtime quite a bit for those who have lengthy initialization
files, because no other shell variables are necessary.
X.sp
X.in +2
X.nf
if !iscurses
X.ti +4
set crt = 24 screen = 18
endif
X.in -2
X.fi
X.sp
This segment checks to see that we're not running in curses mode, and if not
it will set our crt and screen sizes.
This is mostly because the curses mode will set those values for us by looking
at the size of the screen.
Like other interactive commands, the
X.B curses
command itself should never be called from an initialization file.
Doing so will cause terminal settings to be set incorrectly and unpredictable
results from there.
See the CURSES INTERFACE section for configuring your
environment so you enter curses mode each time you run the shell.
X.PP
String evaluation is allowed in \*Qif\*U expressions, and the operators
X\*Q==\*U and \*Q!=\*U may be used to determine equality or inequality.
Usually, variables are compared with constants for evaluation.
X.sp
X.in +2
X.nf
if $TERM == adm3a
X.ti +4
set pager = more
else
X.ti +4
set pager = less
endif
X.in -2
X.fi
X.sp
This segment tests to see if the user's terminal type is \*Qadm3a\*U.
If it is, then it sets the pager variable to be the 
X.I more
program.
Note that the variable TERM will be gotten from the user's environment if a
shell variable is not set already.
Otherwise, the pager variable is set to \*Qless\*U.
This exemplifies the fact that
X.I less
normally fails to function correctly
for the terminal type \*Qadm3a\*U so we don't use it.
X.PP
After sourcing the initialization file,
X.I Mush
reads all the mail out of the specified folder (the system spool directory
if no folder is given) and creates a list of messages.
The current maximum number of messages the user
can load is set to 1000 by default.
The system administrator who configures the program can reset this
value higher or lower if you ask nicely.
If the user has the
X.B sort
variable set, then when the current folder's messages have all been read,
the messages are sorted according to the value of the
variable (see the sort entry under the VARIABLES heading for more information).
Each message has a number of message header lines which contain information
about whom the mail is from, the subject of the message, the date it was
received, and other information about the letter.
This information is then compiled into a one-line summary for
each message and is printed out in an appropriate manner
depending on the interface you're using.
X.PP
At this point, commands may be input by the user.
Lengthy or complex commands can be placed in a file and then executed via the
X.B source
command; for example, a filtering file, "filter", might contain:
X.sp
X.in +2
X.nf
pick -f Mailer-Daemon | save mail_errors
pick -f yukko | delete
pick -s -i thesis | save +thesis_mail
pick -t unix-wizards | +wizmail
update
sort d
X.in -2
X.fi
X.sp
Then the first command the user typed might be \*Qsource filter\*U
and the following would happen:
First, all messages that have \*QMailer-Daemon\*U in the from line
will be saved in the file mail_errors.
Then, all mail from the user \*Qyukko\*U will simply be deleted.
Next, all mail that has in the subject field \*Qthesis\*U
X(case ignored, so \*QThesis\*U would also match) would be
saved in the file $folder/thesis.
The next command will find all messages that are addressed to
the group \*Qunix-wizards\*U (of which the user is an elite
member) and save them in the file $folder/wizmail.
Last, the folder will be updated, removing all deleted mail
X(saved mail may be marked as deleted),
and the folder is reread and sorted according to the date of the messages.
X.SH "GENERAL USAGE"
Because there are three different interfaces available to the user,
the tty characteristics (backspace, kill-word, kill-line, redraw line)
are simulated identically in all interfaces.
When the user has to type something, the 4.2BSD style of tty driver interface
is simulated whether you're in the window system, the curses mode, the tty-line
mode, and even on System-V machines.
This means that backspacing causes a
backspace-space-backspace effect (erasing the character backspaced over).
The user may reset his tty characteristics using the stty command.
X.PP
X.IR "Displaying messages" .
X.PP
Depending on the interface you use, you can display any message in your
list of messages as long as the message is not marked for deletion.
If the message is marked as deleted, then use the 
X.B undelete
command supplied by the interface you are using.
To display a message in line mode, specify a message to be displayed using
X.BR print ,
X.BR type ,
X.BR p ,
X.BR t ,
or by typing the message number, that message will be printed on the screen.
X.PP
In curses mode, move the cursor over the message you want and type
a `t' or `p' to read the message.
The user may \*Qbind\*U other keys to call
the function which displays messages if `t' and `p' are uncomfortable.
X.PP
In the graphics mode, move the mouse over the message you wish to
be displayed and select the LEFT mouse button.
If the message you want is not visible (in the header subwindow), you may type
in the message subwindow the number of the message and hit return.
That message number will be displayed.
X.PP
In the line or curses mode, if the message has more lines than the variable
X.BR crt ,
then a
X.I pager
will be invoked to allow the user to page through the message without
having it scroll off the screen.
The pager used is determined by the variable
X.BR pager .
If that variable is unset, then a default pager will be used.
Note that if pager is set, but not to a value, or is set to the value
of \*Qinternal\*U, then the internal pager is used.
The internal pager
is very simple; the spacebar displays the next
X.B crt
lines, carriage return prints the next line, and \*Qq\*U quits the pager.
X.PP
In the tool mode, if a message is larger than the size of the message
subwindow, the amount of the message viewed is displayed and the user
may page through the message via `+' (forward by lines), `-' (backwards
by lines), LEFT mouse button (forward by pages), or RIGHT mouse button
X(backwards by pages).
The user may precede the `+' and the `-' keystrokes with a numerical
X.I count
to specify how many lines to scroll.
X.PP
An alternative to displaying messages is the
X.B top
command.
This command will print just the top few lines of a message.
The number of lines is determined by the variable
X.BR toplines .
If this variable isn't set,
X.B top
will print a number of lines equal to the value of the variable
X.BR crt .
X.PP
X.IR "Sending mail" .
X.PP
You can send mail using the
X.B mail
command or by responding to other mail.
In either case, when you are sending mail, you are in a mode where everything
you type is added to the contents of the message.
When you are done typing your message, you can type `^D' to signify the end of
the message.
If you have the variable
X.B dot
set, then you can end a message with a `.' on a line by itself.
X.PP
While you are composing a message,
X.I Mush
treats lines beginning with the character `~' specially.
This is called a
X.B tilde escape.
For instance, typing \*Q~i\*U (alone on a line) will place a copy
of the \*Qcurrent message\*U into your message body.
It will not include the message headers of the message, just the body of text
which composes the message.
X.PP
Available
X.BR "tilde escapes" :
X[OPTIONAL arguments in square brackets]
X.TP
X~a file
Append message buffer to file name.
X.TP
X~b [bcc list]
Modify blind carbon recipients; otherwise identical to ~t.
X.TP
X~c [cc list]
Modify carbon copy recipients; otherwise identical to ~t.
X.TP
X~E[!]
Erase message buffer.
Save the contents of the letter to \*Qdead.letter\*U
X(unless the `!' is specified) and then clear the message buffer; the user
remains in editing mode.
If the variable,
X.B nosave
is set, then `!' need not be specified.
X.TP
X~e [editor]
Enter the editor.
Defaults to variable
X.BR editor ,
environment EDITOR, or
X.IR vi .
X.TP
X~F[!]
Add a fortune [don't add] at end of message.
X.TP
X~f [msg#'s]
Forward mail.
The included messages are not indented,
but are marked as \*Qforwarded mail\*U.
X.TP
X~H [msg#'s]
Same as ~i, but also include the message headers.
X.TP
X~h
Modify all message headers.
Each header is displayed one by one and each may be edited.
X.TP
X~i [msg#'s]
Include current message body (or numbered messages).
See the descriptions of the variables
X.BR indent_str ,
X.BR pre_indent_str ,
and
X.BR post_indent_str .
X.TP
X~p [pager]
Page the message body.
Defaults to variable
X.BR pager ,
environment PAGER, or the default pager set up by the system administrator.
This may be the internal pager.
X.TP
X~q
Quit message; save in ~/dead.letter if
X.B nosave
is not set.
X.TP
X~r file
Read filename into message buffer.
X.TP
X~S[!]
Include [don't include] signature at end of message.
The variables,
X.B autosign
and
X.B autosign2
describes the file or string to append to the message.
See the VARIABLES section for more information on these variables.
X.TP
X~s [subject]
Modify the subject header.
If an argument is given (a new subject), then the subject line is
X.I replaced
by the new subject line.
If none is given, then the subject line is
displayed for editing just as in the ~t command.
X.TP
X~t [list]
Change list of recipients (\*QTo\*U list).
If a list is given, this list is
X.B appended
to the current list.
If no list is given, then the current list
is displayed and the cursor placed at the end of the list.
You can backspace over the stuff in the list or you can append more
addresses onto the end of the list as desired.
System-V users
may only replace the line, retyping it if necessary, to append new
users; specifying a list on the tilde line is recommended in this case.
X.TP
X~u
Up one line.
If the user made a mistake typing a letter and he
has already hit carriage return, he may avoid entering the editor
and edit the previous line using ~u.
The line is retyped and
the cursor is placed at the end allowing the user to backspace
over it and retype the line.
System-V users should note that if
the new line is shorter than it was before the ~u command, the
line is padded with blanks to the previous length of the file.
X.TP
X~v [editor]
Enter the visual editor.
Defaults to variable
X.BR visual ,
environment VISUAL, or
X.IR vi .
X.TP
X~w file
Write message buffer to file name.
X.TP
X~x
Exit message; don't save in dead.letter.
X.TP
X~$variable
Insert the string value for variable into message.
If a boolean variable is listed, nothing is appended regardless of its value.
X.TP
X~:command
Run the
X.I Mush
command specified by \*Qcommand\*U.
You may not run any command which sends mail.
It is inadvisable to change folders at this time
since the current message list may be corrupted, but the action is
allowed nonetheless to provide flexibility for experienced users.
X.TP
X~~
A line beginning with two escape characters will be unaffected by
X.I Mush
except that only a single tilde will be inserted into the letter.
X.PP
The variable
X.B escape
may be set to describe a character other than `~' to be used as the
escape character.
When sending mail, the above tilde escapes are available in
all three user interfaces.
X.SH "LINE-MODE INTERFACE"
In the line-mode, the user is given a prompt to which commands are issued
and arguments are passed to commands.
When the user types at the prompt, each line is parsed and words (or,
arguments) are separated into an array of strings.
This array, also called an
X.IR "argument vector" ,
is then modified by expanding history references, command line aliases,
and variable references.
A command line ends when the end of the line is encountered or a pipe (|)
or semicolon (;) character are encountered, separating discrete commands.
X.PP
When a command line has been determined and placed in an argument vector, the
first argument in the vector (the \*Qcommand\*U) is searched for in a list of
legal
X.I Mush
commands.
If found, the function associated with that command is called and
the rest of the line is passed to that function as
X.IR "command line arguments" .
X.PP
Before commands are called, however, the input the user gives is preprocessed
in a style reminiscent of the C-shell
X.RI ( csh ).
X.I Mush
also supports a subset from each of the following aspects of
X.IR csh :
X.in +2
X\(bu Command history.
X.br
X\(bu Command line aliasing.
X.br
X\(bu \*QPiping\*U mechanism to
redirect \*Qinput\*U and \*Qoutput\*U of commands.
X.in -2
X.PP
X.BR "Command history" .
X.PP
The history mechanism remembers commands up to the value of the
X.B history
variable.
If this variable is not set, only the most recent command is remembered.
To reference previously typed commands, the `!' character
is used in the same manner as in
X.IR csh .
There is a limited implementation of history modification;
supported are the argument selectors which reference
command line arguments and \*Q:p\*U (echo, but don't execute the command).
X.sp
Examples:
X.nf
X.in +2
X.ta 1i
X!-2:$	two commands ago, last argument.
X!3:2-4	the third command, arguments two through four.
X!!:p	print the last command in its entirety.
X.in -2
X.fi
X.PP
During the sourcing of initialization files (.mushrc), history is not
in effect and therefore the `!' character does not cause history expansion.
This includes startup of the program and when the command
X.I source
is issued.
UUCP style addresses that contain the `!' character may be given in the
initialization file without the need to be preceded by a backslash.
However, `!' does need to be escaped if
X.BR cmd 's
are used to reference command line arguments.
X.PP
X.BR "Command line aliasing" .
X.PP
This feature enables command substitution similar to
X.IR csh .
To be backwards compatible with UCB Mail, the
X.B alias
command is used for address aliasing.
Thus, the command
X.B cmd
is introduced in place of
X.BR alias .
X.PP
Examples:
X.nf
X.in +2
cmd d delete
cmd t type
cmd dt 'd ; t'
cmd - previous
cmd r 'replysender \\!* -e -i'
X.in -2
X.fi
X.sp
In the last example, if the user types \*Qr 5\*U,
X.I Mush
will reply to sender of the fifth message and pass all the other
arguments along to the
X.B reply
command.
Note the escaping of the `!' character.
This must also be done if set in the initialization file (.mushrc).
Had the user not specified a message number on the `r' command line,
X.B respond
would reply to the \*Qcurrent message\*U rather than the fifth message.
X.PP
X.BR "Piping commands" .
X.PP
X\*QOutput\*U from a command is a
X.BR "message list" ,
not the
X.I text
in a message.
A
X.B "message list"
is defined as the set of messages which the user specifies in a command or
the messages a command affects after it is through executing.
When one command is piped to another, the effect is that the second command
will consider only those messages affected by first command.
In most cases,
X.I Mush
is smart enough to know when piping is occurring and may suppress text output
that a command might produce.
X.PP
Examples:
X.sp
X.ti +2
pick -f fred | save fred_mail
X.sp
This will find all the messages from \*Qfred\*U
and save them all in the file named fred_mail.
X.sp
X.ti +2
lpr 4-8 | delete
X.sp
This will send messages 4, 5, 6, 7, and 8 to the printer and then delete them.
X.sp
X.ti +2
headers :o | delete
X.sp
Delete's all old (already read) mail.
X.PP
Because action is taken on mail messages, not files,
metacharacters such as `*' and `?' are not expanded to file names as
X.I csh
would do.
Instead,
X.I Mush
commands take
X.I "message lists"
as arguments (a list references one or messages) to take action upon.
To reference message numbers,
X.I Mush
understands the following special syntax:
X.sp
X.in +2
X.nf
X.ta 1.0i
X*	All messages
X^	The first message
X$	The last message
X\&.	The current message
N-M	A range of messages between N and M
X.sp
X.fi
X.in -2
In the last case, N and M may be * ^ $ . or digits referencing
explicit message numbers.
The range must be in ascending order.
X.sp
You can also negate messages by placing the message list inside
braces, `{' `}' \*- thus, the expression \*Q2-19 {11-14}\*U references
messages 2 through 19 except for messages 11 through 14.
X.sp
Note that message lists are parsed left to right.
Negated messages may be reset by turning them on
again later in the argument list.
A common error new users make is to specify a negated list without
specifying any beginning messages.
X.sp
X.ti +2
delete { 6 }
X.sp
In this example, the user attempted to delete all messages
except for number 6.
He should have specified `*' beforehand.
A correct example:
X.sp
X.ti +2
preserve ^-. { 3 }
X.sp
Here, the user specifies a valid message list and causes
X.I Mush
to preserve all messages from the beginning of the list (message 1)
to the current message, excluding message 3.
X.PP
As discussed, after the command line is parsed, the command given is
called and the rest of the arguments on the command line are passed to it.
If no
X.I Mush
command has been found that matches the one given, then the variable
X.B unix
is checked.
If it is set,
X.I Mush
attempts to run the command line as a
X.I UNIX
command.
X.PP
If
X.I unix
it is not set, or if the command could not be found in the user's PATH
environment, a message will be printed indicating that the command was
not found.
X.PP
Since no \*Qmessages\*U are affected by
X.I UNIX
commands, piping is disallowed either to or from such commands.
If the user wishes to execute
X.I UNIX
commands which are to be piped to one another (or use any sort of redirection),
the command,
X.B sh
is provided for such purposes.
Since
X.I Mush
will parse the entire command line, caution should be taken to enclose
questionable shell variables or metacharacters with quotes to prevent
X.I Mush
from expanding them.
END_OF_FILE
if test 33606 -ne `wc -c <'mush.1.a'`; then
    echo shar: \"'mush.1.a'\" unpacked with wrong size!
fi
# end of 'mush.1.a'
fi
echo shar: End of archive 11 \(of 14\).
cp /dev/null ark11isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 14 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.