Solved MidnightCommander and .history

I have an odd problem with MC that I can't find any information on. I haven't used Linux in a while so not sure if I had this issue in Linux. So, using tcsh and mc. I try to re-use commands by using up-arrow (too lazy to type), however mc adds crazy entries to my .history file for both my normal user and root. I know this because I tail'd the .history and watched it when mc exited. Here is an example:
Code:
cd "`printf "%b" '\0057home\0057paul\0057\0056config'`"
#+1481077338
cd "`printf "%b" '\0057home\0057paul\0057\0056config\0057mc'`"
#+1481077339
cd "`printf "%b" '\0057home\0057paul\0057\0056config'`"
#+1481077347
cd "`printf "%b" '\0057home\0057paul\0057\0056config\0057mc'`"
#+1481077349
cd "`printf "%b" '\0057home\0057paul\0057\0056config\0057mc\0057mcedit'`"
#+1481077350
cd "`printf "%b" '\0057home\0057paul\0057\0056config\0057mc'`"

Nothing is broken, mc works fine, it's just when I try to run through history commands, I have to run through a bunch of garbage first. Any way to stop this behavior?
 
Last edited by a moderator:
I don't believe there is a way to stop it because these are the commands that MC generates...it is a texted base file manager that interface is rendered with Ncurses.
 
Csh causes this. You can stop this behaviour by using another shell, or unchecking the subshell option in the port options.
 
Well there you go, thanks! I'll rebuild it tonight and unchecked that option. Appreciate the response MarcoB.
 
You're welcome. I also have this same problem and found a discussion on the internet in the mc mailing list from some years ago about this issue. Iirc there isn't a quick fix.
 
With 14.0-R you need to add:-

Code:
alias mc='env SHELL=/usr/local/bin/bash mc'
to either ~/.cshrc or ~/.shrc depending on which your login in shell is set up to.

Also, you need to have installed shells/bash for this to work
 
Back
Top