Search code examples
macosshellcommand-promptboot2docker

Fix the command prompt when using boot2docker


I'm using boot2docker on OS X. If I open up a "normal" terminal, I get the following command prompt:

<machinename>:<currentfolder> <user>$

E.g., when logged in, in my home folder, on my notebook it is:

Schneehase:~ golo$

When starting a terminal using boot2docker, I just get

bash-3.2$

no matter where I am. How can I fix this (and how can I make this permanent)? I am using OS X Yosemite.


Solution

  • The prompt is controlled by the PS1 environment variable.

    Your OS X shell and the boot2docker shell have different values for this variable.

    Run echo "$PS1" in both shells and then set the boot2docker one to match the one you like.

    See the bash man page "Prompting" section for more about what you can do with $PS1.