$PS1 does not render command-line prompt in color in a FreeBSD VM
James E Keenan
jkeen at verizon.net
Wed Oct 12 02:56:29 UTC 2016
This question concerns display of colors in the command-line prompt on
two different FreeBSD installations.
For a couple of months I have been using VirtualBox 5.1.2 to run
FreeBSD-10.3 as a guest on an Ubuntu Linux 16.04 LTS host. When working
in this VM I have been trying to avoid Linuxisms so as to better learn
how to work in a BSD environment. One case: I'm using Bourne shell
rather than Bash as the shell for my own user. In my .shrc file, I have
this assignment for the spelling and color of my command-line prompt:
PS1="[^[[31m\W^[[0m] \$ "
... where in each of two cases the '^[' is the ESCAPE character \033.
This produces a prompt which I can verbally describe as:
open-bracket in white; basename of pwd in red; close-bracket, space,
dollar-sign, space in white
... which in the terminal looks like:
where 'jkeenan' is in red and all the rest is in white. So far so good.
Yesterday I installed FreeBSD-11 as a VM on the same Linux host -- only
this time I switched to using VMWare to house the VM. I brought over my
.profile, .shrc, .vimrc, etc., files from the 10.3 VM to this new one.
I expected them to Just Work. However the terminal inside the VMWare
console seems to be unable to digest the codes for color in the
assignment to $PS1. That value for $PS1 is rendering as:
... all rendered in white; nothing in red. The control sequences to
change from white to red and back again are simply being literally
I should note that the VMWare console is perfectly capable of rendering
different colors. Vim gets nice colors in syntax highlighting for both
sh and perl.
Does anyone have a clue as to why $PS1 DWIMs on FreeBSD-10.3 in
VirtualBox while FreeBSD-11.0 does not in VMWare?
Thank you very much.
More information about the freebsd-questions