1.\" $NetBSD: msgs.1,v 1.19 2013/11/24 19:49:22 dholland Exp $ 2.\" 3.\" Copyright (c) 1980, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)msgs.1 8.2 (Berkeley) 4/28/95 31.\" 32.Dd April 28, 1995 33.Dt MSGS 1 34.Os 35.Sh NAME 36.Nm msgs 37.Nd system messages and junk mail program 38.Sh SYNOPSIS 39.Nm 40.Op Fl fhlpqr 41.Op Ar number 42.Op Ar \-number 43.Nm 44.Op Fl s 45.Nm 46.Op Fl c Op Ar \-days 47.Sh DESCRIPTION 48.Nm 49is used to read system messages. 50These messages are 51sent by mailing to the login `msgs' and should be short 52pieces of information which are suitable to be read once by most users 53of the system. 54.Pp 55.Nm 56is normally invoked each time you login, by placing it in the file 57.Pa .login 58(or 59.Pa .profile 60if you use 61.Xr sh 1 ) . 62It will then prompt you with the source and subject of each new message. 63If there is no subject line, the first few non-blank lines of the 64message will be displayed. 65If there is more to the message, you will be told how 66long it is and asked whether you wish to see the rest of the message. 67The possible responses are: 68.Bl -tag -width Ic 69.It Ic y 70Type the rest of the message. 71.It Ic RETURN 72Synonym for y. 73.It Ic n 74Skip this message 75and go on to the next message. 76.It Ic - 77Redisplay the last message. 78.It Ic q 79Drop out of 80.Nm ; 81the next time 82.Nm 83will pick up where it last left off. 84.It Ic s 85Append the current message to the file ``Messages'' in the current directory; 86`s\-' will save the previously displayed message. 87A `s' or `s\-' may 88be followed by a space and a file name to receive the message replacing 89the default ``Messages''. 90.It Ic m 91A copy of the specified message is placed in a temporary 92mailbox and 93.Xr mail 1 94is invoked on that mailbox. 95.It Ic p 96The specified message is piped through 97.Ev PAGER , 98or, if 99.Ev PAGER 100is null or not defined, 101.Xr more 1 . 102The commands `m', `p', and `s' all accept a numeric argument in place of the `\-'. 103.El 104.Pp 105.Nm 106keeps track of the next message you will see by a number in the file 107.Pa \&.msgsrc 108in your home directory. 109In the directory 110.Pa /var/msgs 111it keeps a set of files whose names are the (sequential) numbers 112of the messages they represent. 113The file 114.Pa /var/msgs/bounds 115shows the low and high number of the messages in the directory 116so that 117.Nm 118can quickly determine if there are no messages for you. 119If the contents of 120.Pa bounds 121is incorrect it can be fixed by removing it; 122.Nm 123will make a new 124.Pa bounds 125file the next time it is run. 126.Pp 127The 128.Fl s 129option is used for setting up the posting of messages. 130The line 131.Pp 132.Dl msgs: \&"\&| /usr/bin/msgs \-s\&" 133.Pp 134should be included in 135.Pa /etc/mail/aliases 136(see 137.Xr newaliases 1 ) 138to enable posting of messages. 139.Pp 140The 141.Fl c 142option is used for performing cleanup on 143.Pa /var/msgs . 144An entry with the 145.Fl c 146option should be placed in 147.Pa /etc/crontab 148to run every night. 149This will remove all messages over 21 days old. 150A different expiration may be specified on the command line to override 151the default. 152This number must be negative and indicates the number of days before 153the present whose messages should be kept; that is, use 154.Fl c Ar \-3 155to remove messages more than three days old. 156.Pp 157Options when reading messages include: 158.Bl -tag -width Fl 159.It Fl f 160Do not print ``No new messages.''. 161This is useful in a 162.Pa .login 163file since this is often the case here. 164.It Fl q 165Queries whether there are messages, printing 166``There are new messages.'' if there are. 167The command ``msgs \-q'' is often used in login scripts. 168.It Fl h 169Print the first part of messages only. 170.It Fl r 171Disables the ability to save messages or enter the mailer. 172It is 173assumed that 174.Ev PAGER 175is set to something secure. 176.It Fl l 177Option causes only locally originated messages to be reported. 178.It Ar number 179A message number can be given 180on the command line, causing 181.Nm 182to start at the specified message rather than at the next message 183indicated by your 184.Pa \&.msgsrc 185file. 186Thus 187.Pp 188.Dl msgs \-h 1 189.Pp 190prints the first part of all messages. 191.It Ar \-number 192Start 193.Ar number 194messages back from the one indicated in the 195.Pa \&.msgsrc 196file, useful for reviews of recent messages. 197.It Fl p 198Pipe long messages through 199.Ev PAGER , 200or, if 201.Ev PAGER 202is null or not defined, 203.Xr more 1 . 204.El 205.Pp 206Within 207.Nm 208you can also go to any specific message by typing its number when 209.Nm 210requests input as to what to do. 211.Sh ENVIRONMENT 212.Nm 213uses the 214.Ev HOME 215and 216.Ev TERM 217environment variables for the default home directory and 218terminal type. 219.Sh FILES 220.Bl -tag -width /var/msgs/* -compact 221.It Pa /var/msgs/* 222database 223.It ~/.msgsrc 224number of next message to be presented 225.El 226.Sh SEE ALSO 227.Xr mail 1 , 228.Xr more 1 , 229.Xr aliases 5 230.\".Xr crontab 5 231.Sh HISTORY 232The 233.Nm 234command appeared in 235.Bx 3.0 . 236