The hosts that in use are either running RHEL kernel 2.6.8-xx with ksh88 or 2.6.9-xx with ksh93
This works perfectly for most hosts and I get the desired output:
userx@hosty:~
$
userx@hosty:~
$ cd Documents/
userx@hosty:~/Documents
$
echo $KSH_VERSION throws a blank line,
I use the vi mode, so an ESC and a CTRL +V gives me the version.
For simplicity, I'll narrow it down to the 93 versions and skip the 88 as host with the older versions are miminal.
I have a feeling its not the KSH version thats causing this.
The prompt works perfectly on:
Version AJM 93t+ 2010-02-02
It fails on
Version M 1993-12-28
Works well on some fails on others with:
Version AJM 93t+ 2010-06-21
On the hosts on which it failed, replacing print with echo ignores the newline character, throwing this output:
userx@hosty:~\n$
I'm sorry that line break is actually the STDOUT on the terminal. I should have corrected it before pasting it here.
The .kshrc has no line breaks and is consistent on all hosts.
Note that I reversed some of the logic so I could use "==" instead of "!=". I use set -o vi , but I have heard of some cases where set -o emacs sometimes invokes the command history mechanism when != is used. If that is part of your problem (i.e. the 1002 in red above), this change should avoid it. I used printf instead of echo -n because it is more portable. (Using echo -n abc in ksh on a Solaris system (and some other UNIX branded systems) should print -n abc followed by a newline rather than abc without a newline that you would get with ksh on some other systems.