[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Suppress Line Wrap?



Ivan Jager wrote:

> On Mon, May 30, 2011 at 01:08:19PM -0500, lrhorer scribbled:
>> In bash, the default when outputting to stdout is to wrap any lines
>> wider than the console display.  Is there a way to suppress this?
> 
> Bash isn't doing the line wrapping. That's your terminal
> emulator. For example, if you're using screen, you can use ^A^R
> to turn off line wrapping. With xterm you can use the +aw option.
> Check the manual for your terminal emulator.

Normally it's a bash shell in a KDE window.  There doesn't seem to be 
any setting for line wrap.

>> During script execution, I want certain lines to be overwritten. 
>> This can be accomplished with the /r escape sequence rather than /n,
>> but if the line is longer than the width of the display, it will
>> still scroll the display.
>> 
>> On a related note, bash doesn't seem to be setting the $COLUMNS
>> variable
>> correctly in a sub-shell.  At the console, the $COLUMNS variable
>> contains the correct terminal width.  If I change the terminal width,
>> the $COLUMNS variable updates accordingly.  If I run a bash script,
>> however, this feature no longer works.  The $COLUMNS variable remains
>> null no matter what I try:
> 
> If you run a bash script, that's not a subshell. It's a
> completely separate, noninteractive shell. And you don't get
> $COLUMNS because it's a noninteractive shell.
> 
> You could try stty -a or something like that...

I submitted a bug report, and the maintainer suggested using COLUMNS=$( 
tput cols )

He has submitted a request to update the man page, making it clear the 
checkwinsize utility does not work in a non-interactive shell.  (Why, by 
the way, doesn't it?  I don't understand why a `kill SIGWINCH <proc>` 
doesn't work.)


Reply to: