Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jul 2012 19:37:47 -0500 (CDT)
From:      Robert Bonomi <bonomi@mail.r-bonomi.com>
To:        freebsd-questions@freebsd.org, mexas@bristol.ac.uk
Subject:   Re: mail(1) save command does not work as in the man page
Message-ID:  <201207260037.q6Q0bl9b086604@mail.r-bonomi.com>
In-Reply-To: <201207251544.q6PFi23j012353@mech-cluster241.men.bris.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
> From owner-freebsd-questions@freebsd.org  Wed Jul 25 10:47:21 2012
> Date: Wed, 25 Jul 2012 16:44:02 +0100 (BST)
> From: Anton Shterenlikht <mexas@bristol.ac.uk>
> To: freebsd-questions@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@bristol.ac.uk   Wed Jul 25 16:36  46/2045  "kuku"
> & s 1 somefile
> "somefile" [New file]
> & h
> >*  1 mexas@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@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@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.  :)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207260037.q6Q0bl9b086604>