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

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

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

#! /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 12 (of 14)."
# Contents:  mush.1.b
# Wrapped by rsalz@fig.bbn.com on Wed Apr 13 20:04:55 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'mush.1.b' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mush.1.b'\"
else
echo shar: Extracting \"'mush.1.b'\" \(38123 characters\)
sed "s/^X//" >'mush.1.b' <<'END_OF_FILE'
See the COMMANDS heading below for more detail.
X.PP
This shell-like quality is for the convenience of the user and is not
intended to replace the functionality of
X.IR sh ,
X.IR csh ,
or any other command interpreter.
X.SH "CURSES INTERFACE"
The curses interface utilizes the curses routines intrinsic to most
UNIX systems these days.
This interface is screen oriented rather
than line oriented and allows the user to access commands and messages
more quickly at the cost of history, piping, and a few commands.
X.PP
Many users who prefer the curses interface might want to always start
all their mail sessions in the curses interface.
Putting the curses
command in your initialization file is a no-no, so you can alias your
login shell mail command to include the -C option.
If you use the Bourne Shell, you're going to have to type it out all the time.
Mush will to attempt to know not to run a shell if you're just sending mail to
someone, so the
X.I csh
command line sequences:
X.sp
X.ti +2
X% alias mail 'mush -C'
X.ti +2
X% mail fred
X.sp
will mail to fred and not enter the shell.
However, if you just said, "mail"
with no arguments, you'll enter the shell in curses mode if you have mail.
If you don't, you'll be told so, and the shell will not start.
If you want to enter curses mode even if
you don't have mail, use the \-S option on the command line.
X.PP
In curses mode, the user's terminal has it's \*Qecho\*U turned off so commands
that are issued are not echoed on the screen.
Certain commands cause the mode
to return to normal for typing purposes (sending mail, for example).
In normal operation, the screen will display the current set of message
headers, the current message number is in the top left corner, the
mail status on the top line, and the cursor will be placed on the current
message.
The number of message headers displayed is set by the variable
X.BR screen .
If the user does not have that variable set, the baud rate is checked and
the size of the screen is set according to optimal refresh time.
Usually, 300 baud gives 7 lines, 1200 gives 14, 2400 gives 22 lines, and all
higher baud rates give the size of the screen, whatever that may be.
Note that the top line is reserved for \*Qstatus\*U and the bottom line is
for user interaction should it be required.
X.PP
The user may now type commands via key sequences which are not echoed
to the screen.
Thus, function keys may be bound to \*Qcommands\*U by using the 
X.B bind
command.
A list of key-to-command bindings can be found at runtime by typing `?'
in curses mode or by using the
X.B bind
command in line mode.
X.PP
The commands to which you can map sequences are intended to be as self
explanatory as possible, but admittedly, it's easier to figure out via
trial and error than to try to wade through this documentation.
A list of the legal curses commands can be obtained when executing the
bind command.
Regular tty line-mode commands are not issued from
the curses interface; only special curses mode commands are understood.
The current list of valid curses commands is:
X.sp
X.ta 1.5i 3i 4.5i
X.in +4
X.nf
alias	back msg	bind	bottom page
chdir	copy	copy list	delete
delete list	display	display next	exit
exit!	first msg	folder	goto msg
ignore	last msg	line mode	lpr
mail	mail flags	my hdrs	next msg
preserve	quit	quit!	redraw
reply	reply all	reverse video	save
save list	saveopts	screen back	screen next
search cont	search down	search up	shell escape
show hdr	sort	sort reverse	source
top	top page	unbind	undelete
undelete list	update	variable	version
write	write list	help
X.fi
X.in -4
X.sp
X.PP
The following is a list of default key-command bindings.
If you specify bind commands in your initialization file that conflict with
these defaults, your settings will override the defaults.
The default settings given here
use the ^-character method to indicate control characters.
Thus, `^X' would mean control-X even
though you'd have to type \*Q\\CX\*U to set
the binding and actually use the control key and the `X' key simultaneously
to really
X.I do
a Control-X.
This is mostly because nroff makes printing the backslash
character so amazingly difficult.
X.TP
X\&., t, p, T=top, n=next
Display (type/print) message.
Top will display the first
X.B crt
lines of a message.
Next will print the next message.
If the current message is deleted, the next undeleted message is found.
You might notice this is different than the line mode, which will return
an error message that the current message is marked as deleted.
X.TP
X+, j, J, RETURN
Go to next message.
X.TP
X-, k, K, ^K
Go to previous message.
X.TP
X^, $
Go to first/last message.
X.TP
X{, }
Go to top/bottom of screen.
X.TP
a
Set aliases.
X.TP
b, B
Set/unset bindings.
X.TP
d, D, u, U
Delete/undelete messages (capitals prompt for message list).
X.TP
f
Change folder.
If current folder has changed, verification for update will be requested.
X.TP
g, 0-9
Go directly to a specified message.
When the \*Qgoto\*U command
is selected, a prompt at the bottom of the window prompts for a
X.BR "message list" .
Anything which describes a message list may be used.
Since
X.I Mush
commands return message lists, a legal
X.I Mush
command enclosed in backquotes may be used to go to a particular message.
The new current message pointer will point to the next
message, returned by the command, that is below the old current message.
An example:
X.sp
X.ti +2
goto msg: `pick -f argv`
X.sp
This will cause the current message to move to the first message
in the current folder from the user \*Qargv\*U that comes after the
message pointed to when the \*Qgoto\*U was issued.
So, if messages 1 and 5
are from the user \*Qargv\*U and the current message the user was on
was message 3, then the new current message would be message 5, since it
is the first message found after message 3 that is from \*Qargv\*U.
X.TP
h
Set personal headers.
X.TP
H
Print header information for the current message.
This only works when the user is provided with the \*Q...continue...\*U
prompt and he wishes to view the current message header instead of
redrawing the entire screen.
X.TP
i
Set ignored headers.
X.TP
m, M
Send mail (capital prompts for mail flags).
X.TP
o, O
Order messages (sort; capital reverses order).
A prompt requests the sort constraints.
X.TP
q, Q, x, X
Quit/exit.
X\&`q' will test to see if the current folder has been updated and prompt
the user to verify updating.
X\&`x' does not update mail, but quits the program.
X\&`Q' does not prompt for update verification; if changes were
made, updating is automatic.
X\&`Q' (quit!) and `X' (exit!) will work even when typed at the
X\*Q...continue...\*U prompt, whereas `q' and `x' will not.
X.TP
r, R
Reply/reply all.
X.TP
s, S, c, C, w, W
Save, copy, or write messages (capitals prompt for message lists).
X.TP
v
Set regular variables (as opposed to environment variables).
X.TP
V
Print version number.
X.TP
z, Z
Print next/previous screenful of message headers.
X.TP
X^L
Redraw the screen.
X.TP
X^P
Preserve current message (toggle).
X.TP
X^U
Update folder.
A prompt will request confirmation.
X.TP
X^R
Toggle reverse video mode (current message is in reverse video).
X.TP
X|
Send message to printer
X.TP
X!
Shell Escape.
Prompts for command; RETURN invokes a shell.
X.TP
X%
change directory.
X.TP
X(, )
Source/saveopts.
Prompts for file name.
X.TP
X/, ^/, ^N
Forward, backward, continue search for patterns.
Entire messages are not searched for here.
Only the text available on the screen is searched for.
Note that some terminals use `^_' (control-underscore) for `^/',
so you may wish to re-bind this key.
X.TP
X:[cmd]
Enter line mode for one command.
If no command is given, curses mode
is exited and the session continues in line mode.
X.PP
When setting new key sequences to be bound to commands, the user may
use control keys and the ESCAPE character for extended commands.
Exceptions are control-C, control-\\, and possibly other control characters
depending on your system's configuration or your current tty interrupt
character settings.
The spacebar may not be bound using the interface
supplied by the curses mode `b'
X.RB ( bind )
command since spaces are stripped before processing.
To bind the spacebar to a function, use the line mode command
X.sp
X.ti +2
bind " " display next
X.sp
This example shows how you can bind the spacebar to display the next message.
This command may be given in the initialization file or on a
X.I Mush
command line.
X.PP
When assigning key sequences to commands, the user enters the
X.B bind
command and prompting is done.
If the
user wishes to have control characters or the escape character in a key
sequence while still using ascii format, the special notation for control
characters is provided.
This sequence is used primarily for the use of
binding control character sequences in the initialization file.
This format
is also used to display the current key-command mappings by the program.
X.PP
To specify control characters in ascii format for the bind command, the
sequence \*Q\\Cc\*U is used where `c' is the
character which the control key will translate to and must be in upper case.
The sequence \*Q\\CP\*U would map to control-P.
If the user wishes to indicate the RETURN key, this is specified
with the string \*Q\\n\*U and
the tab key is specified by the string \*Q\\t\*U.
As a more complex example, on a Wyse-50 terminal, the 8th function key
outputs the three characters: control-A, H, line-feed.
To map this function key to a command, the
user would have to enter the sequence \*Q\\CAH\\n\*U as the key sequence,
then follow up with a valid curses command.
From then on, if the user presses that function key,
then the command mapped to it will be executed.
X.PP
The ESCAPE key is signified by the sequence, \*Q\\E\*U.
On a Sun-3 workstation,
the R1 key outputs the character sequence: ESC, [, 2, 0, 8, z.
The corresponding
X.B bind
key sequence would be \*Q\\E[208z\*U.
Restrictions are that key sequences may not contain the space character
unless bound in line mode, and can never begin with a digit.
X.PP
Whenever a command is entered, other than `^L'
X.RB ( redraw ),
that causes the screen to scroll or be refreshed in any way,
X.I Mush
is left in the
X.I continue
mode.
When in this mode, the user is given his line-mode prompt followed
by \*Q...continue...\*U indicating that he may issue a new command or
return to the top level where the current message headers are displayed
on the screen.
Remember that this is still the curses mode, but much time
is saved by avoiding redrawing the screen after each command.
The user may move up and down messages using the appropriate commands
X(j/k by default) or anything else the curses mode allows.
Only the spacebar and the exit and quit commands will return
to the top level.
Because the exit and quit commands are used to do this, there are 2 additional
ways to \*Qquit\*U from curses mode and return to the login shell.
The \*Qexit\*U and \*Qquit\*U commands will quit from the top level, but
the commands
X.B exit!
and 
X.B quit!
are used to exit from the \*Qcontinue\*U level in the curses interface as well
as from the top level.
X.PP
Note that the best way to understand the curses interface is to just use it.
In line mode, the command \*Qcurses\*U puts you into curses mode.
X.SH "GRAPHICS INTERFACE"
When running the window-based graphics interface, there will be 5
windows displaying panels of commands, message headers and a text
window which is used for displaying messages or writing messages
to send to other users.
X.PP
The panel items have labels describing their functionality.
Selecting
a panel item with the LEFT mouse button causes the action to be executed.
The RIGHT mouse button displays a menu of options that the command may
branch to.
For example, the
X.B save
panel item by default will save messages to the file "mbox", but if the
RIGHT mouse button causes a menu to be displayed the choices of where
to save the message increases to include the items in the menu.
These typically include the files in the user's folder directory (see the
X.B folder
variable below).
X.PP
At the end of each list of menu entries for panel items is an item
labelled \*Qhelp\*U.
When this item is chosen, help with that command
is displayed in the center of the console.
X.PP
When composing letters, the interface is the same for the tool mode,
the line mode and the curses mode.
Tilde escapes are recognized by all
the interfaces, but the tool interface allows the user to use the menu
mouse button to select the tilde escape desired.
X.PP
If the user wishes to review a mail message while in edit-mode, he may
do as the other interfaces and enter the tilde escape command \*Q~:print\*U.
This will cause the current message (or the numbered message, if given) to
be displayed in the window.
Editing is temporarily put on hold till the user
enters a `q' in the message window to indicate that he is done reading the
message and input is to be directed again to the letter being composed.
X.SH COMMANDS
Described below are legal commands understood by
X.I Mush
that you can type at the line mode prompt.
Most commands have abbreviations
X(given in parentheses) and can be followed by message lists.
In most cases,
whitespace is not necessary to separate commands from message lists.
For example, \*Qd*\*U will delete all messages, and \*Qu1-7 {4}\*U will
undelete messages 1 through 7 except for message number 4.
X.PP
The ability to customize commands using the
X.B cmd
facility allows users to customize
X.I Mush
to resemble other mailers.
However, efforts have already been made to include commands which are backwards
compatible with other line-mode mailers.
Users of the graphics tool mode of
X.I Mush
may have little need for the command line mode because the icon based
interface allows interaction with many commands.
The graphics mode is much more restrictive in favor of user
friendliness but most useful commands may be achieved anyway.
X.PP
The following is a list of all recognized commands.
X.TP
X.B alternates
X.RB ( alts )
This command
is useful if you have accounts on several machines.
It can be used to inform
X.I Mush
that the listed addresses are really you.
When you
X.B reply
to messages,
X.I Mush
will not send a copy of the message to any of the addresses
listed on the
X.B alternates
list.
If the
X.B alternates
command is given with no argument, the current set of alternate
names is displayed.
X.TP
X.B cd
Change the working directory to that specified, if given.
If no directory is given, then changes to the user's home directory.
X.TP
X.BR cmd / uncmd
Command line aliases are set and unset using these commands.
More extensive information is given in the LINE-MODE INTERFACE section.
X.B Uncmd
may take `*' as an argument to uncmd everything set.
X.TP
X.BR debug " [N]"
Set debugging level to N (1 by default).
When in debug mode, the user can see some of the flow of
control the program makes while executing.
The intent of the debug level is for tracking down
bugs with the program at specific locations.
Periodically, the program may segmentation fault and core dump.
When this happens, the user can reenter the program,
set the debugging level and recreate the problem.
X.sp
If the user suspects memory allocation problems, a debugging
level of 2 or higher will prevent memory from being freed causing no
overwriting of memory bounds.
X.sp
If the user suspects sendmail errors,
a debugging level of 3 or higher will prevent sendmail from starting
and outgoing mail is sent to the standard output instead of actually
being sent.
X.TP
X.BR delete / undelete
X.RB ( d / u )
Takes a message list as argument and marks them all as deleted.
Deleted messages will not be saved in
X.IR mbox ,
nor will they be available for most other commands.
If the folder has not been updated, deleted messages can be recovered
with
X.BR undelete .
X.TP
X.B dt
Deletes the current message and prints the next message.
X.TP
X.B echo
Echoes all the arguments given on the command line, expanding variables
and history references.
X.TP
X.B exit
X.RB ( x )
Effects an immediate return to the login shell without
modifying the current folder or system spool directory.
X.TP
X.B expand
Aliases, given as arguments, are expanded as they would be if you
were to send mail to each.
X.TP
X.BR fkey / unfkey
Prints the values of the function keys.
The function keys are used in
the graphics tool mode only.
You can set the values of function keys explicitly using the
X.B fkey
command, but the whole process is automated by using the function key
interface provided by the graphics mode.
By default, the last key in each function key pad displays
the values of all the function keys in that set of function keys.
There are the left, right and top set of keys.
X.TP
X.BR folder " [\-N] [\-r] [!] [ %[user] | # | & | file ]"
X.RB ( fo )
Change current folder.
With no arguments, prints the name of the current folder.
The arguments are:
X.nf
X.ta 1i
X.in +2
X\-N	No headers are displayed upon entering new folder
X\-r	Set Read-Only mode (can't alter new folder)
X!	If specified, the current folder is not updated
X%[user]	Change to /usr/spool/mail/[user] (default is yours)
X#	Switch back to the previous folder
X&	Change folder to $mbox (default is ~/mbox)
X.in -2
X.fi
X.TP
X.B folders
List the names of the folders in your folder directory.
Your folder directory is the directory
X.I Mail
in your home directory.
Or, you can set the variable
X.B folder
to specify another folder directory.
X.br
X.TP
X.BR from " [ + | \- ]"
X.RB ( f )
With no arguments, from will print the current message's header.
If given a message list, from will print the headers of those
messages which are in the list.
X.sp
The special arguments `\-' and `+' can be given to move the
current message pointer to the previous or next message
respectively while also printing that message's header.
If a message list was given in addition to `\-' or `+', then
the current message pointer will be set to the first or last
message, respectively, in the message list given.
Examples:
X.sp
X.ti +2
pick \-f Dan | from +
X.sp
will print the headers of all messages that contain Dan in
in the author's name and set the current message pointer to
the last one of that kind in the list.
X.sp
X.ti +2
from \- 10-30 {16}
X.sp
will print the headers of messages 10 through 30 except for
message 16 and set the current message pointer to 10.
X.sp
X.ti +2
from +
X.sp
will print the header of the message after the current message
and increment the current message pointer to the next message.
X.sp
X.ti +2
from $
X.sp
will print the last message's header and not move the current
message pointer.
X.TP
X.BR headers " [ \-H[:c] ] [ + | \- ]"
X.RB ( h ,
X.BR z )
Prints a screenful of message headers listed in the
current folder.
If a message number is given on the command line,
the first message of the screenful of messages will be
that message number.
The `z' command is identical to the \*Qh +\*U
command and remains for compatibility reasons.
The variable
X.B screen
may be set to tell how many headers are in a screenful.
In the graphics tool mode, the variable
X.B screen_win
contains the number of headers used in the headers subwindow.
X.sp
A typical header may look like:
X.sp
X.ti +2
X5 >N  argv@spam.istc.sri.com Feb 19, (10/278) Test
X.sp
This line indicates that it is message number 5 and the
X.I >
indicates that the \*Qcurrent message pointer\*U is pointing to this
message.
The next two positions indicate the message status.
The first
may be one of, \*QN\*U (new and unread), \*QU\*U (old, but still
unread), \*Q*\*U (deleted), \*QO\*U (old and read), \*QP\*U (preserved),
or \*Q \*U (read).
The second position may have an \*Qr\*U if the message
has been replied to.
X.sp
The author of the example message header is
X.IR argv@spam.istc.sri.com ,
the date is
X.IR "Feb 19" ,
the number of lines in the message is
X.IR 10 ,
the number of characters is
X.I 278
and the subject of the message is
X.IR Test .
The format of the message header exemplified here is described by
the string variable
X.BR hdr_format .
The example given above has a hdr_format of
X.sp
X.ti +2
set hdr_format = "%25f %7d (%l/%c) %25s"
X.sp
See the description of
X.B hdr_format
in the VARIABLES section for more information on header formats.
X.sp
You can print a special subset of message headers by using the
X.I \-H:c
option, where `c' is one of:
X.nf
X.in +2
X.ta 1i
n    new messages
d    deleted messages
u    unread messages
o    old messages
r    replied to messages
a    all messages
X.fi
X.in -2
X.sp
More options to the
X.B headers
command include
X.RI ` + '
and
X.RI ` \- '.
Each will print the next or previous screenful of message headers.
The
X.B z
command can also be used; `z' alone will print the next
screenful (thus, the `+' is optional),
and \*Qz \-\*U is equivalent to \*Qh \-\*U.
X.sp
Headers affects all the messages it displays, so piping may be done
from the headers command.
Piping to the headers command causes the
message headers affected by the previous command to be printed.
This action is identical to piping to the
X.B from
command.
X.TP
X.B help
Help is provided on a per topic basis and on a general basis.
For general help, just typing
X.I help
will provide some general information as to how to get further help
and a list of topics suggested for more specific help.
There is also help provided for each command by using the \-?
option to most commands.
This option will provide command line usage information as well as a
description of what the command does and how to use it.
X.TP
X.BR history " [\-h] [\-r] [N]"
This command displays the command history in chronological order; early
commands are printed first followed by more recent commands displayed last.
Option
X.I \-h
suppresses printing of history event numbers with each history command.
Option
X.I \-r
reverses the order of the history events displayed.
X.sp
If a number
X.I N
is given, then that number of previous commands is
echoed rather than the number set by the variable
X.BR history .
X.TP
X.BR ignore / unignore
Display or set a list of headers to be ignored when displaying messages.
When reading messages, all the message headers are displayed with the text
body of the message.
Since these message identifier fields are cumbersome and uninteresting
in many cases, you can filter out unwanted headers by using this command.
For example,
X.sp
X.ti +2
ignore Received Date Message-Id
X.sp
will ignore the three specified fields.
The command
X.B unignore
is used to reverse the effects of
X.BR ignore .
X.TP
X.BR lpr " [\-Pname] [msg_list]"
takes a message list and sends those messages, one by one, to the printer,
each separated by page feeds.
A default printer name is supplied if one is not specified on the
command line (-Pprinter-name).
If you have the variable
X.B printer
set, that printer name will be used.
X.sp
If the variable
X.B print_cmd
is set, the command described by that variable will be used instead
of the default system command.
In such cases, the -P option and the
X.B printer
variable are ignored and the command is simply executed as is.
This is useful for piping messages through to UNIX
commands (commands not a part of
X.IR Mush .
X.TP
X.B ls
This command duplicates the
X.I UNIX
command
X.I /bin/ls.
The variable
X.B lister
describes flags to be passed to ls automatically.
By default,
X.I ls
always uses the -C flag (column output).
X.TP
X.BR mail " [flags] [recipient ...]"
X.RB ( m )
Send mail to a list of users.
If no recipient list is specified on the
X.I Mush
command line, then a \*QTo: \*U prompt will request one.
A list of recipients must be supplied.
This implementation of
X.I Mush
supports mailing to files and programs as recipients, but at least one
legitimate user must be specified.
Filenames must be full pathnames, thus, they must start with a `/' or there
is no way to know whether a recipient is a pathname or a real user.
The special characters `+' and `~' may precede pathnames since they are
expanded first to the user's folder directory (+), as described by the variable
X.BR folder ,
and the user's home directory (~).
Mailing to programs is indicated by the pipe `|' character preceding the
program name.
Since the user's path is searched, full pathnames are not required for
programs which lie in the user's PATH environment variable.
Example:
X.sp
X.ti +2
mail username, /path/to/filename, "|program_name", +folder_name, ~user/mbox
X.sp
Options are:
X.nf
X.in +2
X.if n .ta 1.5i
X.if t .ta 1.8i
X\-e	immediately enter editor (autoedit)
X\-F	add random fortune to the end of message
X\-s [subject]	prompt for subject [set subject explicitly]
X\-f [msg_list]	forward msg_list (not indented)
X\-h [msg_list]	include msg_list with headers
X\-i [msg_list]	include msg_list into letter
X\-v	verbose (passed to mail delivery program)
X.in -2
X.fi
X.sp
The verbose option may not be available depending on the mail transport
agent on your system.
X.sp
The \-e flag causes you to enter the editor described by the variable
X.BR visual .
X.sp
The \-i flag will include the current message into the body of the
message you are about to send.
The included message is indented by
the string \*Q> \*U or by the string described by the variables
X.BR indent_str ,
X.BR pre_indent-str ,
and
X.BR post_indent_str .
See the VARIABLES section for more information on these string values.
If a message list is given after the \-i option, then the message
described by that list are included.
The \-h option is identical to the \-i option except that the headers of
the message are also included.
X.sp
The \-s flag looks at the next argument and sets the subject to that
string.
If the string is to contain spaces, enclose the entire subject
in quotes.
If there is no following argument, then the subject will
be prompted for.
This flag is useful if the user:
X.sp
X.in +2
X.nf
X\(bu	does not have the variable \fBask\fR set, or
X\(bu	wishes to change the subject used with \fBreply\fR
X.in -2
X.fi
X.sp
The subject is not prompted for and is ignored completely if the \-f flag
is specified (see below).
X.sp
The \-f flag is for message forwarding only.
An optional message list can be given just as the -i option has.
The forward option does not allow you to edit the message(s) being forwarded
unless the -e flag is also specified.
The subject of the message (if available) is the same as the \fIcurrent\f
message; it not necessarily the message of the message being forwarded.
The subject of forwarded mail cannot be changed.
However, using the \-e flag
will allow the user to change the subject once in editing mode using the
escape sequence, \*Q~s\*U.
X.sp
Forwarded mail that has not been edited by the user will contains special
headers such as
X.sp
X.ti +2
Resent-To:
X.ti +2
Resent-From:
X.sp
and perhaps other depending on your mail transport agent.
Sendmail, for example, will add a number of other \*QResent-*\*U headers.
X.TP
X.BR my_hdr / un_hdr
You can create personalized headers in your outgoing mail using this command.
X.sp
X.nf
Usages:
X.in +2
X.ta 2.5i
my_hdr	print all your headers
my_hdr header	print value of header
my_hdr header: string	set header to string
un_hdr header:	unset header
X.in -2
X.sp
X.fi
To set a header, the first argument must be a string
that contains no whitespace (spaces or tabs) and must end with
a colon (:).
The rest of the command line is taken to be the
text associated with the mail header specified.
If any quotes are used in the header and the header itself is not set in
quotes, then quotes should be escaped (preceded) by a backslash.
This holds true for semicolons, pipe characters
or any other metacharacter that
X.I Mush
might interpret as a command line modifier.
X.sp
If the variable
X.B no_hdrs
is set, then your headers will not be added to outgoing messages,
but no headers will be unset.
The
X.B un_hdr
command may take `*' as an argument to un_hdr everything set.
X.TP
X.BR pick " [flags] [<pattern>]"
Allows the user to select particular messages from a folder.
The <pattern> is a \*Qregular expression\*U as described by
X.IR ed .
If no arguments are given, the previous expression searched for is used.
You can search for messages from a user, for a particular subject line,
between certain dates, and limit searches to a range of messages.
You can also find all messages that do not
match the same arguments mentioned above.
X.sp
X.nf
Options:
X.ta 1.5i
X.in +2
X\-d [\-]date	messages sent on or after [`\-' before] date
X\-f	search for pattern in \*QFrom\*U field only
X\-h header	search for pattern in specified header only
X\-i	ignore case of letters when searching
X\-r msg_list	search only the listed messages
X\-s	search for pattern in \*QSubject\*U field only
X\-t	search for pattern in \*QTo\*U field only
X\-x	select messages not containing the pattern
X.in -2
X.fi
X.sp
Only one of \-d, \-f, \-h, \-s and \-t can be specified at once.
Entire messages are scanned for the <pattern>
unless \-f, \-h, \-s or \-t is specified.
Messages marked for deletion are also searched.
No patterns can be specified with the \-d option,
and the \-x option may not be used with \-d.
X.sp
For the \-d option, \*Qdate\*U is of the form:
X.sp
X.ti +2
month/day/year
X.sp
with an optional `\-' to specify that the messages of interest are those
older than that date.
Omitted fields of the date default to today's values.
Examples of selecting on date:
X.nf
X.in +2
X.ta 2.0i
X.sp
pick \-d 4/20	on or after April 20, this year
pick \-d \-/2/85	on or before the 2nd, this month, 1985
pick \-d /	today only
X.fi
X.in -2
X.sp
At least one `/' char must be used in a date.
There is no strong date checking; 2/30 would be considered a valid date.
X.sp
Other examples of
X.B pick:
X.sp
X.ti +2
pick \-d 2/5/86 | pick \-d \-2/5/87 | pick \-s "mail stuff" | lpr
X.sp
will find all the messages between the dates February 5, 1986 and
February 5, 1987 that contain the subject "mail stuff" and print them.
X.sp
X.ti +2
pick -s Re: | delete
X.sp
deletes messages that have \*QRe:\*U in the subject
X.sp
X.ti +2
folder +project | pick -f frank
X.sp
Finds all messages from frank in the folder described by +project.
X.sp
X.ti +2
pick -h return-path ucbvax
X.sp
Searches all messages that have the header "Return-Path:" and determines
if the string \*Qucbvax\*U is in the header.
Note that case sensitivity
applies only to the pattern searched, not the header itself.
X.TP
X.B preserve
X.RB ( pre )
Saves a message list in your spool directory rather than
your mailbox unless it has been explicitly deleted.
The variable
X.B hold
causes all messages to be held in your spool directory automatically.
X.TP
X.B print
X.RB ( p ,
X.BR type ,
X.BR t )
Takes a message list and displays each message on the user's terminal.
If the first letter of the command is a capital letter (`P' or `T'),
then \*Qignored\*U headers are not ignored
X.I provided
that the variable,
X.B alwaysignore
is not set.
If the variable is set, the ignored headers will be
ignored regardless of the command used to display the message.
See the
X.B ignore
command for more information about ignored message headers.
X.sp
The `+' and the `-' keys can be used to display the \*Qnext\*U
and \*Qprevious\*U messages respectively.
The `+' key has the caveat that the
message is not paged at all and none of the messages headers are displayed.
X.TP
X.B pwd
Prints the current working directory.
X.TP
X.B quit
X.RB ( q )
Updates the current folder and exits from
X.IR Mush .
If the variable \*Qhold\*U is set, all messages not marked for deletion are
saved in the spool directory.
Otherwise, messages which have been read are saved to
X.I ~/mbox
or to the file described by the string variable
X.BR mbox .
Messages marked for deletion are discarded.
Unread messages go back to the spool directory in all cases.
X.TP
X.BR reply / replyall " [flags]"
X.RB ( r / R )
Messages are replied to by sending mail to the sender of each message
in the given message list.
The commands
X.B replysender
and
X.B respond
are equivalent to
X.BR reply .
X.B Replyall
responds to all the recipients as well as the sender of the message.
These commands understand all the same flags as the
X.B mail
command.
X.sp
When constructing a return mail address to the author of a message,
X.B reply
searches for special mail headers in the author's message which
indicate the most efficient mail path for return mail.
X.I Mush
will search for the \*QFrom:\*U, \*QReply-To:\*U,
and \*QReturn-Path:\*U headers by default.
X.sp
If none of these fields are found in the message, the first line of the
message is parsed;
this \*QFrom \*U line is different from the \*QFrom: \*U line.
If the user wishes to change the order or the actual fields to search for
return paths, then the variable
X.B reply_to_hdr
may be set to a list of headers to be used (in the order specified).
If it is set, but has no value, the first \*QFrom \*U line is used
regardless of what headers the author's message contains.
This is a special case setting for the variable \*-
the \*QFrom \*U line may not be specified explicitly as an item in the
list of reply-to headers.
X.sp
When replying to all recipients of the message using the
X.B replyall
X.RB ( R )
command, only the original author's address can be obtained from
the message headers.
There is no way determine the best path to the
other recipients of the message from message headers aside from taking
their addresses directly from the \*QTo:\*U and \*QCc:\*U lines.
X.sp
Also see the explanation of the variable
X.B auto_route
and the MAIL ADDRESSES section for more information concerning
replying to messages.
X.TP
X.BR save / write / copy " [!] [message list] [filename]"
X.RB ( s / w )
With no arguments,
X.B save
and
X.B write
will save the current message to the file
X.I mbox
in the user's home directory (or the file specified by the
X.B mbox
variable).
If a message list is given, then the messages specified by
the list are saved.
If a filename is given, then that filename is used instead of mbox.
If the file exists and is writable, the specified command
will append each message to the end of the file.
If the `!' is given, then the file is overwritten causing whatever contents it
contains to be lost.
The
X.B write
command differs from
X.B save
and
X.B copy
in that the message headers are
X.I not
saved in the file along with the body of text.
X.sp
If the current folder is the system mailbox, then saved messages are
marked for deletion when the user exits using the
X.B quit
command.
If the variable
X.I keepsave
is set or the current folder is not the system mailbox, then messages are
not marked for deletion.
The
X.B copy
command is is like
X.B save
except that messages are never marked for deletion, whether or not
X.B keepsave
is set.
X.sp
Because message lists are used to determine the messages to be saved,
if the user wishes to save messages to a file that begins with a digit
or any other message list metacharacter, a backslash should precede
the filename to escape the message list expansion routine.
The backslash will not become a part of the filename.
X.TP
X.BR saveopts " [file]"
The complement of
X.BR source ,
X.B saveopts
will save all settable variables, aliases
and cmd's in the initialization file.
X(See the
X.B source
command for more information on initialization files.)
If an argument is given, that file is used.
Beware that this will overwrite files, so any \*Qif\*U expressions
will be lost, as will settings that have changed since entering
X.IR Mush .
Using saveopts is highly discouraged
and is intended for the naive user only.
X.TP
X.BR set / unset
With no arguments, prints all variable values.
Otherwise, sets option.
Arguments are of the form \*Qoption=value\*U (whitespace is allowed).
Boolean expressions need not have \*Q=value\*U associated in the command.
X.sp
The special command
X.sp
X.ti +2
set ?all
X.sp
will print all known variables utilized by the program and a brief
description of what they do.
The user may set and manipulate his own set of variables, but internal
variables that are utilized by the program are the only ones displayed.
X.sp
The command
X.sp
X.ti +2
set ?variable_name
X.sp
will print the same information for one variable instead of all variables.
You may unset everything by issuing the command \*Qunset *\*U.
X.TP
X.BR sh " [command]"
Invokes an interactive version of the shell.
The shell spawned is described by the variable
X.BR shell .
If the optional argument
X.B command
is given, then that command is executed under the Bourne Shell.
If the special character `&' is at the end of any shell command,
then the command will be executed in background.
X.TP
X.BR source " [file]"
Read
X.I Mush
commands from a file.
If no filename is specified, the files searched
for are .mushrc or .mailrc in the user's home directory.
If the environment variable MAILRC is set, then that file is sourced.
If a filename is given on the command line, that file is sourced.
See the
X.B INITIALIZATION
heading and the
X.B home
variable descriptions for more information.
X.TP
X.B sort " [-] [d | a | s | S | R]"
This command
will sort messages according to author, date, status or subject
X(with or without considering the "Re: ", in replied messages).
In addition, the messages can be sorted in reverse order (same arguments).
X.sp
X.nf
Options:
X.in +2
X.ta 1i
X-	reverse sort order
d	sort by date received
a	sort by author (alphabetical)
s	sort by subject ignoring \*QRe:\*U
R	sort by subject (alphabetical)
S	sort by message status
X.in -2
X.fi
X.sp
Note that only one argument (except for the `-'), may be used.
By default (no arguments),
X.B sort
sorts messages by
X.IR status .
New, unread messages are first, followed by preserved messages,
and finally deleted messages are placed at the end of the list.
X.sp
If the variable
X.I sort
is set, messages are sorted each time the user's system mailbox is
read as the current folder.
The
X.I sort
variable can be set either to nothing or to legal "sort" arguments.
X.sp
Subsorting can be achieved by using the piping mechanism intrinsic to
the line mode interface;
no other interface allows subsorting \*Qdirectly\*U.
Each interface may allow subsorting if appropriate actions are taken,
as discussed below.
X.sp
To subsort messages, the folder must be in a particular order to begin
with.
To sort mail by author and then by subject heading, you would
have to first sort by author:
X.sp
X.ti +2
sort a
X.sp
Now that the messages are in order according to author, sorting a
sublist of messages is done using pipes:
END_OF_FILE
if test 38123 -ne `wc -c <'mush.1.b'`; then
    echo shar: \"'mush.1.b'\" unpacked with wrong size!
fi
# end of 'mush.1.b'
fi
echo shar: End of archive 12 \(of 14\).
cp /dev/null ark12isdone
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.