Set terminal width inside a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Set terminal width inside a shell script
# 1  
Old 09-01-2009
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.
# 2  
Old 09-02-2009
The problem is on line 42.
# 3  
Old 09-02-2009
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.
# 4  
Old 09-03-2009
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.
# 5  
Old 09-03-2009

We cannot help if you don't show us the script.
# 6  
Old 09-03-2009
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.
# 7  
Old 09-03-2009
Try

Code:
mailx -L

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Htop process viewer - set column width

I try to enlarge the htop column's width. I've found a solution, but it seems very specific and also too difficult. Is there any simpler way to make all the characters in a column visible? (0 Replies)
Discussion started by: plaidshirtuser
0 Replies

2. Shell Programming and Scripting

Help needed with shell script to search and replace a set of strings among the set of files

Hi, I am looking for a shell script which serves the below purpose. Please find below the algorithm for the same and any help on this would be highly appreciated. 1)set of strings need to be replaced among set of files(directory may contain different types of files) 2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies

3. Shell Programming and Scripting

Problem run script inside a gnome-terminal

hi, I would like to ask about using gnome-terminal command, I had a script that will run my VBOX VM in headless and i want to display the output(STDOUT) on the gnome-terminal window. The purpose that i want to display the STDOUT of the script cause i will used it or create a desktop shortcut for... (11 Replies)
Discussion started by: jao_madn
11 Replies

4. Shell Programming and Scripting

Whats the meaning of set -e inside the script

Hi, I would like to ask about the meaning or purpose of set -e in the script bash, Does it mean if a wrong command in the script it will close or exit the script without continuation thats what happen if i set it in the terminal. Thanks in advance (3 Replies)
Discussion started by: jao_madn
3 Replies

5. Programming

get terminal width and height

I was reading Advanced Programming in the Unix Environment and it says to use ioctl() to get the terminal's width and height. I wrote this program: // print width and height #include <stdio.h> #include <unistd.h> #include <sys/ioctl.h> #include <termios.h> int main( int argc, char... (3 Replies)
Discussion started by: Ultrix
3 Replies

6. Shell Programming and Scripting

Appending string (charachters inside the line) to a fixed width file using awk or sed

Source File: abcdefghijklmnop01qrstuvwxyz abcdefghijklmnop02qrstuvwxyz abcdefghijklmnop03qrstuvwxyz abcdefghijklmnop04qrstuvwxyz abcdefghijklmnop05qrstuvwxyz Whatever characters are in 17-18 on each line of the file, it should be concatenated to the same line at the character number... (6 Replies)
Discussion started by: tamahomekarasu
6 Replies

7. Programming

terminal Width/height change

Hi, i am very new to unix/linux programming. for one of the application i have to change the Terminal width and height. i did try this if (ioctl (fd, TIOCGWINSZ, &win)) return; if (y && y >24) win.ws_row = y; else win.ws_row = 24; if (x && x>80)... (2 Replies)
Discussion started by: bgsunny
2 Replies

8. Programming

get terminal width and cursor position

I want to get the screen width and cursor positions. When I used curses, all the screen content was cleared. So Can I use curses to get the screen size without clearing anything in the window? Or is there any other alternative??? I can use only C or C++. (0 Replies)
Discussion started by: Sreejesh.S
0 Replies

9. Shell Programming and Scripting

How to run unix commands in a new shell inside a shell script?

Hi , I am having one situation in which I need to run some simple unix commands after doing "chroot" command in a shell script. Which in turn creates a new shell. So scenario is that - I need to have one shell script which is ran as a part of crontab - in this shell script I need to do a... (2 Replies)
Discussion started by: hkapil
2 Replies
Login or Register to Ask a Question