Delete all mails using mailx or mail

Hi , ?im a newbie using shell scripts.
Is there any way to write a script that will delete all mails from my mailbox using mail or mailx command

Thanks for your time

E. Festas

I guess the question is why use mail or mailx? Why not just delete your mailbox?

$ rm /var/spool/mail/rfestus

Carl

Another way :

echo 'd *' | mail -N

Jean-Pierre.

1 Like