PROMPT_COMMAND causing strange cursor behavior
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-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin' -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic uname output: Linux beacon 3.18.7-200.fc21.x86_64 #1 SMP Wed Feb 11 21:53:17 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-redhat-linux-gnu Bash Version: 4.3 Patch Level: 33 Release Status: release Description: When the PROMPT_COMMAND variable is set to a command such a printf it causes the cursor to jump to disappear or jump to the wrong positions when typing text that spans more than physical terminal line. The problem exists in at least Bash 4.2 and 4.3 (but likely earlier versions as well). Repeat-By: 1) Open a terminal window (either XTerm or GNOME Terminal) 80 columns wide. (The exact width shouldn't matter.) 2) Either set the TERM variable to vt100 or xterm, or unset it. The setting doesn't eliminate the problem but tends to have a slightly different effect on how it manifests. 3) Set the PROMPT_COMMAND variable to a string such as "printf '123: '" and unset PS1 (the second part isn't necessary to reproduce the problem). 4) Observe the shell prompt and the cursor after the trailing space: "123: " 5) If using GNOME Terminal, type as many characters as necessary for the cursor to advance to the last column of the terminal window. Then type one more character and observe the cursor disappear. (It doesn't seem to disappear in XTerm.) 6) In either terminal proceed to type more characters. The line will wrap around, continuing in column 1. Before the cursor advances to line up with the first typed character on the line above, observe it jump to column 1. 7) Continue typing more characters and observe the text overwrite the previously typed and displayed characters. 8) Enter ctrl+a to move the cursor to the beginning of the typed line and observe it jump into the middle of the prompt instead to the beginning of the typed text.
Re: 'help typeset' doesn't show -n option
On 4/27/15 10:32 AM, Valentin Bajrami wrote: > I'm sure I could use ''declare'' because of the above mentioned reason, but > shouldn't typeset mention it's -n option? Yes, it should. typeset and declare are equivalent. Thanks for catching this. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
'help typeset' doesn't show -n option
Hi, While looking at indirect reference of variables, typeset seems to support the -n option. For example var="value" typeset -n ref=var echo "${!ref}"="$ref" However when running ''help typeset'' I don't see the -n option. [0][val@laptop:~]$ help typeset typeset: typeset [-aAfFgilrtux] [-p] name[=value] ... Set variable values and attributes. Obsolete. See `help declare'. I'm sure I could use ''declare'' because of the above mentioned reason, but shouldn't typeset mention it's -n option? Valentin