Hi John, > I think I've discovered a bug in mksh. According to the man page:
no, you’ve discovered you did not read the manpage ☺ PS1 The primary prompt for interactive shells. Parameter, com- […] Since backslashes and other special characters may be inter- preted by the shell, to set PS1 either escape the backslash itself or use double quotes. The latter is more practical. This is a more complex example, avoiding to directly enter special characters (for example with ^V in the emacs editing mode), which embeds the current working directory, in re- verse video (colour would work, too), in the prompt string: x=$(print \\001) # otherwise unused char PS1="$x$(print \\r)$x$(tput so)$x\$PWD$x$(tput se)$x> " Due to a strong suggestion from David G. Korn, mksh now also supports the following form: PS1=$'\1\r\1\e[7m\1$PWD\1\e[0m\1> ' > It turns out that the invisible ANSI escape sequences count towards > the length of the line! This means that mksh "breaks" the line much > earlier than necessary, making it difficult to use colors in the > prompt. Yes, of course. It does not “know” that those are ANSI escapes, after all (not all terminals use them, you know). That is the reason for the above mechanism, from ksh88, to exist. See also: http://www.mirbsd.org/mksh-faq.htm#ps1conv bye, //mirabilos -- “The final straw, to be honest, was probably my amazement at the volume of petty, peevish whingeing certain of your peers are prone to dish out on d-devel, telling each other how to talk more like a pretty princess, as though they were performing some kind of public service.” (someone to me, privately)