I made something similar to this for Midnight Commander because I have a multi-line prompt for regular terminals but mc only has one line of command...in other words, mc screws up the prompt..
This is what I put in .bashrc:
Code:
if [ "${mcON}" = "1" ]; then
PS1="[ \@ - \u ] "
else
set_prompt
fi
"set_prompt" is a function which sets the multiline prompt.
"mcON" is a variable which is set from an alias or command: export mcON=1; mc -b
This is not completely bug-free, though. I had to disable the mcON variable in .xinitrc in the event that I started mc in terminal before starting X.