I often use the subshell of mc. So I want the promt of mc-subsell to be different form the primary shell. Say, how can I change the sub-prompt like this:
This page may help you. An excerpt:
Bash allows users to do very advanced things when defining shell prompt, including colours and propagation of information into xterm title. Unfortunately, when you want to use mc (Midnight Commander) in conjunction with bash prompts, you may find, that not all advanced escape sequences are handled by mc properly. To overcome this issue you can have a special prompt just for mc.
What you wanted:
if ps $PPID |grep mc; then PS1="mc: \w" fi
I had faced with the same problem, before I found a recipe: put the following text into the file ~/.local/share/mc/bashrc :
#!/bin/bash if [ -f $HOME/.bashrc ]; then . $HOME/.bashrc else if [ -f /etc/bashrc ]; then . /etc/bashrc fi fi if [ -z "$PS1" ]; then PS1="(mc)[\u@\h \W]\$ " else old_PS1=$PS1 export PS1="(mc)$old_PS1" fi
or according to your need:
#!/bin/bash if [ -f $HOME/.bashrc ]; then . $HOME/.bashrc else if [ -f /etc/bashrc ]; then . /etc/bashrc fi fi PS1="mc:\$\W\$ "