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

Re: Suppress Line Wrap?



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.

> 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...

Ivan


Reply to: