When you copy the dot.mkshrc sample file (ugh, the FreeBSD porters have colourised some
parts of it?) to ~/.mkshrc then mksh will give you the username, hostname and current
working directory before the $ (or #). You can of course write your own, it’s just a
sample ;-)
Colourising that is rather easy and, in mksh (as opposed to, say, pdksh), comes without
side effects. The sample file starts the effective PS1 with ^A^M (i.e. control-a or ASCII
0x01, and control-m or \r or ASCII 0x0D). This enables a “magic mode†first known from
AT&T ksh88 which allows you to wrap your escapes into matching pairs of ^A, like you use
\[ and \] in GNU bash.
Since mksh, by urging from Dave Korn himself, now supports $'…', you can use
│ PS1=$'\1\r\1\e[7m\1$PWD\1\e[0m\1> '
or things like that (this is actually an example line from the manual page, not
a prompt I use, but it works like that too). The prompt from dot.mkshrc is much
more complex, for example it applies the replacing of $HOME with ~ similar to
GNU bash’s \w and, in addition to that, prevents the rest from being wider than
about a third of the display.
Also, you could send me your (GNU bash syntax) prompt per eMail and I’ll convert
it to mksh syntax for you (unless I get a bazillion eMails per day…) – you should
of course state if you want the whole directory (/home/foo/bar), \w (~/bar), or
just the last part, for example.
I will update the online versions of the manpage to match mksh-current right
after submitting here:
• https://www.mirbsd.org/man1/mksh or https://www.mirbsd.org/man/mksh.1
• https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh.pdf
It should be noted that I will *not* be monitoring this web forum, I just
stumbled across this thread (it was pointed out to me). There are support
channels (both IRC and eMail) documented.
parts of it?) to ~/.mkshrc then mksh will give you the username, hostname and current
working directory before the $ (or #). You can of course write your own, it’s just a
sample ;-)
Colourising that is rather easy and, in mksh (as opposed to, say, pdksh), comes without
side effects. The sample file starts the effective PS1 with ^A^M (i.e. control-a or ASCII
0x01, and control-m or \r or ASCII 0x0D). This enables a “magic mode†first known from
AT&T ksh88 which allows you to wrap your escapes into matching pairs of ^A, like you use
\[ and \] in GNU bash.
Since mksh, by urging from Dave Korn himself, now supports $'…', you can use
│ PS1=$'\1\r\1\e[7m\1$PWD\1\e[0m\1> '
or things like that (this is actually an example line from the manual page, not
a prompt I use, but it works like that too). The prompt from dot.mkshrc is much
more complex, for example it applies the replacing of $HOME with ~ similar to
GNU bash’s \w and, in addition to that, prevents the rest from being wider than
about a third of the display.
Also, you could send me your (GNU bash syntax) prompt per eMail and I’ll convert
it to mksh syntax for you (unless I get a bazillion eMails per day…) – you should
of course state if you want the whole directory (/home/foo/bar), \w (~/bar), or
just the last part, for example.
I will update the online versions of the manpage to match mksh-current right
after submitting here:
• https://www.mirbsd.org/man1/mksh or https://www.mirbsd.org/man/mksh.1
• https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh.pdf
It should be noted that I will *not* be monitoring this web forum, I just
stumbled across this thread (it was pointed out to me). There are support
channels (both IRC and eMail) documented.