Unix Shell - "mail" command oddity

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > October 2006 > "mail" command oddity





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author "mail" command oddity
jaredsubman@yahoo.com

2006-10-24, 1:17 pm

For some reason, the redirected output of this command truncates the
subject at 80 characters and I don't know how to change it.

Where "input" contains just one line, "q", the following command
displays full headers to the screen:

mail < input
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/jaredsubman": 3 messages 3 new
>N 1 root@myserver.com Tue Oct 24 07:12 10/468 "This is a long subject line is untruncated"


However, when I try:
mail < input > output.txt

The resultant file "output.txt" truncates the headers at 80 characters.

cat output.txt
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/jaredsubman": 3 messages 3 new
>N 1 root@myserver.com Tue Oct 24 07:12 10/468 "This is a long subject lin"



I've also tried:

mail << EOF > output.txt
q
EOF

and:

echo q|mail > output.txt

And gotten similar results. Any ideas on how to make this command give
full header output redirected to a file?
Thanks in advance.

Michael Tosch

2006-10-24, 7:17 pm

jaredsubman@yahoo.com wrote:
> For some reason, the redirected output of this command truncates the
> subject at 80 characters and I don't know how to change it.
>
> Where "input" contains just one line, "q", the following command
> displays full headers to the screen:
>
> mail < input
> Mail version 8.1 6/6/93. Type ? for help.
> "/var/spool/mail/jaredsubman": 3 messages 3 new
>
> However, when I try:
> mail < input > output.txt
>
> The resultant file "output.txt" truncates the headers at 80 characters.
>
> cat output.txt
> Mail version 8.1 6/6/93. Type ? for help.
> "/var/spool/mail/jaredsubman": 3 messages 3 new
>
>
> I've also tried:
>
> mail << EOF > output.txt
> q
> EOF
>
> and:
>
> echo q|mail > output.txt
>
> And gotten similar results. Any ideas on how to make this command give
> full header output redirected to a file?
> Thanks in advance.
>


Probably some old code does it.
Older versions of mail always truncate after 80 characters,
regardless if output is a terminal or redirected to file/pipe.

--
Michael Tosch @ hp : com
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com