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. To achieve that, consider the following shell sniplet:
if ps $PPID |grep mc; then
PS1="[\u@\h:\w]\$ "
else
PS1="${TITLEBAR}\$BLUE[$RED\$(date +%H%M)$BLUE]\
$BLUE[$LIGHT_RED\u@\h:\w$BLUE]\
$WHITE\$$NO_COLOUR "
fi
The resulting prompt will look something like this:
[andre@host:/a/b/c/project/subproject]$ |










2 Comments
Good tutorial, simple and
Submitted by Zakaria (not verified) on
Good tutorial, simple and easy
Thanks for sharing the idea.
Submitted by Juri (not verified) on
Thanks for sharing the idea. Helped me to set a simplified (and unbroken) prompt for zsh if started with mc.
Add new comment