Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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

share|improve this question
    
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
add comment

2 Answers 2

up vote 1 down vote accepted

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
share|improve this answer
    
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
add comment

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.