Thread View: gnu.bash.bug
1 messages
1 total messages
Started by James J Dempsey
Sat, 07 Oct 1989 16:45
bug with long prompt strings containing newlines
Author: James J Dempsey
Date: Sat, 07 Oct 1989 16:45
Date: Sat, 07 Oct 1989 16:45
34 lines
1631 bytes
1631 bytes
[ bash 1.03, Sparcstation-1, SunOS 4.0.3c, gcc 1.35, yacc ] I like to know what my current directory is all the time. When I'm using X (which is usually) I have a PROMPT_COMMAND which puts the current directory (and hostname) in the title bar of the xterm window. However, when I'm dialing in from home, I set my PS1 to something like this: export PS1="\w \t\n\h $ " which ends up printing a prompt something like this: /usr/jjd 12:35:13 underdog % which is fine except when the current directory gets too long. Whenever bash tries to do editing, it gets confused about the length of the prompt. It thinks that the prompt is the length of the string PS1 without taking into account the \n characters. It should consider the length of the prompt to be the number of characters (after expansion) after the last \n. To reproduce this bug try this: PS1='012345678900123456789001234567890012345678900123456789001234567890\n$ ' (that's sixty characters followed by a newline, a dollarsign and a space) Then at the prompt type abcdefghijklmnopqrstuvwxyz followed by a ^A. When bash tries to reposition the cursor following the ^A command, it will get confused because it thinks the prompt is 63 characters instead of two. --Jim--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads