mail(1) save command does not work as in the man page

Robert Bonomi bonomi at mail.r-bonomi.com
Thu Jul 26 00:36:51 UTC 2012


> From owner-freebsd-questions at freebsd.org  Wed Jul 25 10:47:21 2012
> Date: Wed, 25 Jul 2012 16:44:02 +0100 (BST)
> From: Anton Shterenlikht <mexas at bristol.ac.uk>
> To: freebsd-questions at freebsd.org
> Subject: mail(1) save command does not work as in the man page
>
> According to the man mail(1):
>
>      save    (s) Takes a message list and a filename and appends each 
>      message
>              in turn to the end of the file.  The filename in quotes, 
>              followed by the line count and character count is echoed on 
>              the user's terminal.
>
> However, it seems the mail is copied, but not deleted on exit:

*SOMETIMES* that is true.   <grin>
>
> $ mail -f mbox
> Mail version 8.1 6/6/93.  Type ? for help.
> "mbox": 1 message
> >   1 mexas at bristol.ac.uk   Wed Jul 25 16:36  46/2045  "kuku"
> & s 1 somefile
> "somefile" [New file]
> & h
> >*  1 mexas at bristol.ac.uk   Wed Jul 25 16:36  46/2045  "kuku"
> & q
>
> $ mail -f somefile
> Mail version 8.1 6/6/93.  Type ? for help.
> "somefile": 1 message
> >   1 mexas at bristol.ac.uk   Wed Jul 25 16:36  46/2045  "kuku"
> & q
>
> So the mail was copied to <somefile> file, as expected. However, it's 
> still in mbox file too:
>
> $ mail -f mbox
> Mail version 8.1 6/6/93.  Type ? for help.
> "mbox": 1 message
> >   1 mexas at bristol.ac.uk   Wed Jul 25 16:36  46/2045  "kuku"
> & q
> $
>
> This shouldn't happen. According to the man page the expected behaviour 
> is that message 1 should be deleted from mbox on quit.
>
> Any comments?

This is the 'standard'/*EXPECTED* behavior of 'mail', and has been, since
the early 1980s.   (I still use 'mail' as my standard mail client'.)

If invoked _without_ specifying a maibox, 
  1) mail that is written to another mailbox is deleted from the inbox on exit.
  2) mail that was read, but _not_ written/deleted is saved to 'mbox'.

If invoked *WITH* '-f', messages are not deleted/moved on exit.  you must 
_explicitly_ perform any desired actions.


You've found a bug in the _documentation_, not the progam.  :)




More information about the freebsd-questions mailing list