Re: Line breaks in bash
Igor Pechtchanski wrote: On Thu, 29 Apr 2004, Buchbinder, Barry (NIH/NIAID) wrote: -Original Message- From: Andrew DeFaria Sent: Thursday, April 29, 2004 1:18 PM To: cygwinatcygwindotcom Subject: Re: Line breaks in bash When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? Maybe you are missing a \] in the prompt. What you really want is something like this: \[\e]0;\w\a\e[01;33m\]C09-272-A:\[\e[0m\] Placing a \ after the \e and before the [01 and 0m causes those functions to fail. Any sequence of non-printable characters should be enclosed in '\['..'\]' for bash to not count it towards the current length of the line. Fixed my prompt to \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m\] however the problem is the same. The trick is to enclose *only* the unprintable characters thus my final resulting PS1 string is: \[\e]0;\w\a\e[01;33m\]C09-272-A:\[\e[0m\] (What are \w and \a doing? man bash says that they should be the current working directory and a bell, but they don't act like that in this prompt for me.) '\e]0;' will set the window title to the string that follows it (up to a '\a', so that's the terminator). So, the above should set the window title to the current working directory, and the prompt will be displayed as C09-272-A:. If you wanted the current working directory displayed in the prompt, you could use \[\e[01;33m\]C09-272-A:\w:\[\e[0m\] instead. Igor Some people like the directory in the prompt - I like it in the title. Directory paths tend to be long, leaving you less and less space to type the command in. Also, being a sys adm of many machines I'm often more concerned with which machine I'm operating on. -- It doesn't matter what temperature a room is, it's always room temperature. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Line breaks in bash
When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? -- The sex was so good that even the neighbors had a cigarette. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: Line breaks in bash
Maybe you are missing a \] in the prompt. What you really want is something like this: \[\e]0;\w\a\e[01;33m\]C09-272-A:\[\e[0m\] (What are \w and \a doing? man bash says that they should be the current working directory and a bell, but they don't act like that in this prompt for me.) -Original Message- From: Andrew DeFaria Sent: Thursday, April 29, 2004 1:18 PM To: [EMAIL PROTECTED] Subject: Re: Line breaks in bash When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: Line breaks in bash
On Thu, 29 Apr 2004, Buchbinder, Barry (NIH/NIAID) wrote: -Original Message- From: Andrew DeFaria Sent: Thursday, April 29, 2004 1:18 PM To: cygwinatcygwindotcom Subject: Re: Line breaks in bash When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? Maybe you are missing a \] in the prompt. What you really want is something like this: \[\e]0;\w\a\e[01;33m\]C09-272-A:\[\e[0m\] Any sequence of non-printable characters should be enclosed in '\['..'\]' for bash to not count it towards the current length of the line. (What are \w and \a doing? man bash says that they should be the current working directory and a bell, but they don't act like that in this prompt for me.) '\e]0;' will set the window title to the string that follows it (up to a '\a', so that's the terminator). So, the above should set the window title to the current working directory, and the prompt will be displayed as C09-272-A:. If you wanted the current working directory displayed in the prompt, you could use \[\e[01;33m\]C09-272-A:\w:\[\e[0m\] instead. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_[EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! I have since come to realize that being between your mentor and his route to the bathroom is a major career booster. -- Patrick Naughton -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Line breaks in bash
I get the behaviour even if I comment out all the complex PS1 definitions in /etc/profile. To see it, open a bash (windows console, I don't know about rxvt) and resize it to be larger than the 80x25 (mode.com con lines=50 cols=120). Then type away (at a prompt) and see that the text will wrap at ~80 characters. Now, export COLUMNS=120. Same problem. Now, launch another bash from this console, and resize it to 120 wide. Finally, it does the right thing. So, it seems that COLUMNS needs to match the width of the screen, AND something else that only happens (by default anyways) when a new bash is started. Maybe someone else knows what that might be? On Thu, Apr 22, 2004 at 05:37:18PM -0700, AJ Reins wrote: --- Andrew DeFaria wrote: When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? Yes. You have a \[ to indicate non-printing characters without the closing \]. -- I don't suffer from insanity. I enjoy every minute of it. Me too! (sorry about that! (acutally I'm not, but lets not quibble over tribbles!)) __ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ http://photos.yahoo.com/ph/print_splash -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Line breaks in bash
Which OS? Win9x console is pretty much braindead. Cygwin's programs (notably bash) have code for processing a SIGWINCH, which they should receive whenever a window (console or otherwise) that they're running in gets resized. However, the code for sending this signal will only detect a *window* resize -- I don't know whether the one via mode.com will also be detected[*]. Try killing bash with SIGWINCH. Also, bash doesn't use the COLUMNS/ROWS variables, it looks at the same info that stty gets -- run stty -a and see if it picks up the window size. Igor [*] It is on Win2k, FWIW. On Fri, 23 Apr 2004, Ashok Vadekar wrote: I get the behaviour even if I comment out all the complex PS1 definitions in /etc/profile. To see it, open a bash (windows console, I don't know about rxvt) and resize it to be larger than the 80x25 (mode.com con lines=50 cols=120). Then type away (at a prompt) and see that the text will wrap at ~80 characters. Now, export COLUMNS=120. Same problem. Now, launch another bash from this console, and resize it to 120 wide. Finally, it does the right thing. So, it seems that COLUMNS needs to match the width of the screen, AND something else that only happens (by default anyways) when a new bash is started. Maybe someone else knows what that might be? On Thu, Apr 22, 2004 at 05:37:18PM -0700, AJ Reins wrote: --- Andrew DeFaria wrote: When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? Yes. You have a \[ to indicate non-printing characters without the closing \]. -- I don't suffer from insanity. I enjoy every minute of it. Me too! (sorry about that! (acutally I'm not, but lets not quibble over tribbles!)) -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_[EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! I have since come to realize that being between your mentor and his route to the bathroom is a major career booster. -- Patrick Naughton -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Line breaks in bash
It was XP in my case. The stty -a followed by a kill -WINCH my-bash-pid works (even with a mode.com based resize). Thanks for the insight. I hope the original poster gets something out of this too. On Fri, Apr 23, 2004 at 11:13:05AM -0400, Igor Pechtchanski wrote: Which OS? Win9x console is pretty much braindead. Cygwin's programs (notably bash) have code for processing a SIGWINCH, which they should receive whenever a window (console or otherwise) that they're running in gets resized. However, the code for sending this signal will only detect a *window* resize -- I don't know whether the one via mode.com will also be detected[*]. Try killing bash with SIGWINCH. Also, bash doesn't use the COLUMNS/ROWS variables, it looks at the same info that stty gets -- run stty -a and see if it picks up the window size. Igor [*] It is on Win2k, FWIW. On Fri, 23 Apr 2004, Ashok Vadekar wrote: I get the behaviour even if I comment out all the complex PS1 definitions in /etc/profile. To see it, open a bash (windows console, I don't know about rxvt) and resize it to be larger than the 80x25 (mode.com con lines=50 cols=120). Then type away (at a prompt) and see that the text will wrap at ~80 characters. Now, export COLUMNS=120. Same problem. Now, launch another bash from this console, and resize it to 120 wide. Finally, it does the right thing. So, it seems that COLUMNS needs to match the width of the screen, AND something else that only happens (by default anyways) when a new bash is started. Maybe someone else knows what that might be? On Thu, Apr 22, 2004 at 05:37:18PM -0700, AJ Reins wrote: --- Andrew DeFaria wrote: When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? Yes. You have a \[ to indicate non-printing characters without the closing \]. -- I don't suffer from insanity. I enjoy every minute of it. Me too! (sorry about that! (acutally I'm not, but lets not quibble over tribbles!)) -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ [EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_ [EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! I have since come to realize that being between your mentor and his route to the bathroom is a major career booster. -- Patrick Naughton -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: Line breaks in bash
From: Ashok Vadekar Sent: Friday, April 23, 2004 5:13 PM It was XP in my case. The stty -a followed by a kill -WINCH my-bash-pid works (even with a mode.com based resize). Thanks for the insight. I hope the original poster gets something out of this too. Trying to add some more traces... On Fri, Apr 23, 2004 at 11:13:05AM -0400, Igor Pechtchanski wrote: Which OS? Win9x console is pretty much braindead. Cygwin's programs (notably bash) have code for processing a SIGWINCH, which they should receive whenever a window (console or otherwise) that they're running in gets resized. However, the code for sending this signal will only detect a *window* resize -- I don't know whether the one via mode.com will also be detected[*]. Try killing bash with SIGWINCH. Also, bash doesn't use the COLUMNS/ROWS variables, it looks at the same info that stty gets -- run stty -a and see if it picks up the window size. Igor [*] It is on Win2k, FWIW. When using $COLUMNS and/or $LINES in bash startup scripts I've had to do the following to get somewhere... The problem has seemed (to me) be a delay before the env-vars get set. i.e: It is problematic to attempt to use $COLUMNS/$LINES before the bash prompt has appeared for the first time (Using cygwin+W2K on an [EMAIL PROTECTED] if that matters). -- snip -- # Make bash reread console COLUMNS and LINES kill -WINCH $$ kill -WINCH $PPID if [ -z $COLUMNS ] ;then echo 12 ${0##*/}: WARNING; \ \$COLUMNS unset in bash (PID:$$) dispite sending SIGWINCH! fi -- snip -- /Hannu E K Nevalainen, B.Sc. EE - 59+16.37'N, 17+12.60'E ** on a mailing list; please keep replies on that particular list ** -- printf(LocalTime: UTC+%02d\n,(DST)? 2:1); -- --END OF MESSAGE-- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Line breaks in bash
When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? -- I don't suffer from insanity. I enjoy every minute of it. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Line breaks in bash
At 06:34 PM 4/22/2004, you wrote: When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Works fine for me. Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? Yes, apparently. I could reproduce your problem using your prompt. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 838 Washington Street (508) 893-9889 - FAX Holliston, MA 01746 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Line breaks in bash
--- Andrew DeFaria wrote: When I type a long line in the bash shell it seems to get confused when it passes the first 80 character barrier and does a newline. Below is an example. C09-272-A:# why is it in bash that when I get close to typing 80 characters bash does som ething like this? Now set my prompt to the hostname as \[\e]0;\w\a\e[01;33mC09-272-A:\e[0m. Could this be causing the problem? Yes. You have a \[ to indicate non-printing characters without the closing \]. -- I don't suffer from insanity. I enjoy every minute of it. Me too! (sorry about that! (acutally I'm not, but lets not quibble over tribbles!)) __ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ http://photos.yahoo.com/ph/print_splash -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/