4

I observed that my custom bash prompt does not work on mc. How do I customize it?

  • WHere do you set your custom bash prompt? – Mark Nov 23 '12 at 13:43
  • My custom bash prompt is setup in .bash_profile – sorin Nov 23 '12 at 14:01
4

The issue is that .bash_login files are only read when bash is run as the login shell. mc probably just calls a new shell which will read its startup from ~/.bashrc See bash documentation for details.

To make the shell run in a common way it is often suggested that you call .bashrc from .bash_login e.g.

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi
  • I did this and now I see the prompt correctly, still there is a difference: all ANSI escapes had vanished from mc prompts, it's not colored. – sorin Nov 23 '12 at 15:16
  • I suspect $TERM has been changed as man mc says it is " run it in a pseudo terminal," – Mark Nov 24 '12 at 0:39
  • 2
    That bugreport midnight-commander.org/ticket/2027#comment:21 has clear answer: >> Is there a way to get the prompt colors show up also in MC? > Unfortunately no. It is not supported, аll control sequences in the > prompt are ignored. – Hubbitus Aug 18 '15 at 16:16
-2

Read the INVOCATION section of the man page, it's there for a reason. MC is most likely not launching a login shell and you are only configuring your prompt for login shells.

  • 1
    Excerpt from man mc: "An extra added feature of using the subshell is that the prompt displayed by the Midnight Commander is the same prompt that you are currently using in your shell." - As you probably observed this is not true, the prompt is clearly not the same, in fact I suspect it's the default prompt for bash bash-3.2$. – sorin Nov 19 '12 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .