Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall uname output: Linux debian 3.11-2-amd64 #1 SMP Debian 3.11.10-1 (2013-12-04) x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.2 Patch Level: 45 Release Status: release Description: The simplest PS1 prompt which demonstrates the issue is: PS1="\[\033[01;31m\]Hello world\n\u@\h:\[\033[01;32m\]\w\$\[\033[00m\] " The issue is that a lengthy current working directory gets split up before the width of the terminal is reached. This happens only when colour sequences are used. When no colour sequences are used, the prompt works correctly. I tested this on Fedora 20 (same version of bash as above) and could reproduce the issue. Repeat-By: 1. Create a long directory path for the test. E.g. mkdir -p "/tmp/a_long_directory_name/getting_even_bigger_so_that_I_can_test/this_prompt_is_working_fine_or_not" 2. Ensure your terminal size is 80x24. I've tested this on linux console/xterm/konsole/lxterminal and PuTTY. 3. Set the PS1 prompt to: PS1="\[\033[01;31m\]Hello world\n\u@\h:\[\033[01;32m\]\w\$\[\033[00m\] " Prompt should look like: Hello world root@debian:~$ 4. Change to the long directory path: cd "/tmp/a_long_directory_name/getting_even_bigger_so_that_I_can_test/this_prompt_is_working_fine_or_not" 5. Observe that the prompt is now displayed as: root@debian:/tmp/a_long_directory_name/getting_even_bigger_so_that_I_can_test/th is_pr ompt_is_working_fine_or_not$ Fix: The only work around I identified is to: a) Not have any colour sequences after the \n b) or to not have the \w after the \n