Bash does not wrap long lines correctly


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Bash does not wrap long lines correctly
# 1  
Old 06-24-2013
RedHat Bash does not wrap long lines correctly

Ksh is my default shell, but I want use the bash shell since its convenient to me.

When I type a long command line in a terminal, it does not wrap to the next line when I reach the end of the line and it wraps onto the same line, overwriting my prompt and the rest of what I typed.

Code:
$ echo $SHELL
  /bin/ksh
  $ ve and accept responsve and accept responsve and accept responsve and accept responsve and accept responsve and accept responsve and accept responsve and accept responsve and accept responsve
  $ bash
   ash-3.2$ sponsve and ae asponsve and ae asponsve and ae asponsve and ae asponsve and ae asponsve and ae asponsve and ae
  bash-3.2$ stty -a
  speed 38400 baud; rows 44; columns 120; line = 0;
  intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
  stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
  -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -cdtrdsr
  -ignbrk -brkint ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany imaxbel -iutf8
  opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
  isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
  bash-3.2$ tput cols
  120
  bash-3.2$ echo $TERM
  xterm
  bash-3.2$ export TERM="vt100"
  bash-3.2$ echo $TERM
  vt100
   ae and accept responsve and ae and accept responsve and ae and accept responsve and ave and ae and accept responsve and
  bash-3.2$

I searched in the Unix and internet, all problem solved by modifying the customized PS1 command but I don't have any customized prompt I am using default one.



Thnaks
Senthil.
# 2  
Old 06-25-2013
unless someone has a better answer ...

a customized prompt will not help with the line wrapping on the terminal as far as i know ... since you are using xterm -- assuming you are not on the console -- your issue is more likely the client you have is misconfigured ... check the terminal window options for the fix ...
# 3  
Old 06-25-2013
I believe it has to do with ANSI escape sequences in the prompt, they will be taken as part of its length even though they don't contribute to string length, just string colors. This will make it miscalculate where it wraps the line.
# 4  
Old 06-27-2013
I guess there is a bug in your bash, or there is a bug in the terminal definition it uses, or it was build with a different one.
What's your OS?
What's the path to bash?
Code:
uname
type bash

# 5  
Old 06-27-2013
@MadeInGermany
Code:
bash-3.2$uname
Linux
bash-3.2$type bash
bash is a tracked alias for /bin/bash

@Corona688
I am not using any custom prompt the i am using the default prompt only.

@Just Ice
I am not using any custom prompt the i am using the default prompt only. Yes i am not on console. I used to connect server via putty.

One more thing i noticed that when i open vi editor its not showing any line in a file( which contains some code) when use arrow marks it will become visible.

Thanks
Senthil
# 6  
Old 06-28-2013
when exactly does this issue happen? on initial connect onwards or only after you have been connected a few hours/days/months?

when was the last time you rebooted your pc? what else are you running on your pc? how many app windows do you have open? have you checked the putty settings to confirm everything is correct? if unsure, reset putty settings to default and check again ...

if still an issue, who else is affected and how many? if everybody is affected, your issue may be network or server load related. check server logs first for errors or warnings. if only some people affected, look at difference between okay people and affected people particularly how many app windows they have open, network speed and RAM amount ...

or get your windows admin to troubleshoot further ...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Fork and Execvp Not Executing Bash Commands From C correctly.

I had been looking at page 75 of this online book: http://richard.esplins.org/static/downloads/linux_book.pdf I've used the system function in C to call bash commands before, but wanted to learn this way too. The solution in the book worked perfectly. However, I tried changing the simple "ls -l... (3 Replies)
Discussion started by: Azrael
3 Replies

2. Shell Programming and Scripting

Perl one liner to wrap comment lines

Greetings fellow scripters. I find myself editing multiple files, sometimes with the same bits of information. My bash script, a changelog, and a plist file (OS X). Once I realized this, I thought why not script part of this process (and so it begins). In any case, I've solved several of the... (1 Reply)
Discussion started by: reid
1 Replies

3. UNIX for Dummies Questions & Answers

sed and awk for long lines

Hi, I'm trying make a variable length file to a fixed length of 4000. I'm to pad spaces on the right of a record if length is less than 4000 to make the record length 4000. I'm trying to use the below commands awk '{printf "%-4000s\n", $0}' inputfile.dat > outputfile.dat sed -e :a... (12 Replies)
Discussion started by: uxusr
12 Replies

4. Shell Programming and Scripting

Geographical distance between long and lat in bash

Does anyone know of any script or packages that allow the calculation of the geographical distance between two points of lat/long from within a bash shell? I have been searching the web for the past few days and none of the options seem compatible with bash variables... (eg. geodist) Many... (3 Replies)
Discussion started by: lily-anne
3 Replies

5. Shell Programming and Scripting

Wrap lines with awk to create SQL script

Greetings! Some of my files list hardware errors (we test electronic components), some have none. If the file name has no errors, I still want to display a message like "No error", else I display the error from the file itself. I came up with this (with help) for myfile in `find . -name... (2 Replies)
Discussion started by: alan
2 Replies

6. Shell Programming and Scripting

splitting long string into several lines?

I'm using a barcode scanner to grab ISBNs. Unfortunately, short of hitting "enter" each time (not easy while on a ladder), there's no good way to split it up. So I scanned it into a series of long lines in notepad. Now, I need to split each line into 12-number lines. instead of:... (4 Replies)
Discussion started by: mbourgon
4 Replies

7. UNIX for Dummies Questions & Answers

Lines too long error

Hi Gurus, I have a big file having around 5000 lines. What I need to do is as below. $cat myfile aaaa bbbb ccc ddd ... I want the output to be as below: 'aaaa,'bbbb','cccc'.... For this I have written something like this code: vi sac.txt |nawk '{printf NR","}'>ss code: (2 Replies)
Discussion started by: thana
2 Replies

8. Shell Programming and Scripting

How to get BASH to interpret pipes in a string correctly?

In a BASH library I'm creating, I have two functions that look like: function check_process { PIDFILE=$1 if ; then PID=`cat $PIDFILE` if && ; then return 1 fi; fi; return 0 } function fork_process { CMD=$1 PIDFILE=$2 ... (2 Replies)
Discussion started by: neked
2 Replies

9. UNIX for Dummies Questions & Answers

removing lines in a too long file

HI, i need to remove about a 3000000 lines in a "too long file", without using vi editor. Im using hp-ux 11.0. (4 Replies)
Discussion started by: Goodfella
4 Replies

10. Shell Programming and Scripting

Re: Long command lines

Hello, AIM: Need to test for the presence of some files (*.F) in a certain directory. having a problem with this line is ksh: if test `ls $SOMEDIR/dir/*.F \ 2>/dev/null|wc -w` -eq 0 Basically testing for the presence of *.F files in the specified directory. If the return... (4 Replies)
Discussion started by: enoch
4 Replies
Login or Register to Ask a Question