Set terminal width inside a shell script

Hi all,

I have a shell script which uses "mailx -H" to get the subject of a email in a Linux system.

However, the subject is truncated, and I think it has something to do with the terminal width because it only returns the first 80 characters of each line.

I have tried "stty columns" inside the script, but it doesn't work.

Any suggestions is greatly appreciated.

Thanks.

The problem is on line 42.

Suggestion: If the full line is there when you redirect the command output to a file, you may need to set "wrap" in the settings for your terminal emulator.

The line width is truncated to 80 when the output is redirected to a file.

Is it possible to set the output of "mailx -H" to longer than 80 chars when redirecting to a file ?

Thanks a lot.

We cannot help if you don't show us the script.

The problem is as follows:
$ mailx -H > out.txt
$ cat out.txt
> 1 Mail Delivery Subsys Fri Aug 21 21:27 69/2497 "Warning: could not se"

The line in out.txt is truncated to 80 chars. But if I enter the command interactively in the shell, I get the full line:
$ mailx -H
> 1 Mail Delivery Subsys Fri Aug 21 21:27 69/2497 "Warning: could not send message for past 4 hours"

Thanks.

Try

mailx -L

What is the output of:

ls -l out.txt