Re: Navigate directories with MC

Gilberto F da Silva via mc wrote on 02/08/2019 09:33 AM:
     Since when I started using Linux around the 2000s I use mc. I can
     not use Linux if mc is not installed on it. I'm having a hard time
     using mc in Debian 9.x. I browse the directories and when I leave
     the mc I go back to the directory where I called mc. In Slackware,
     mc behaves differently. When I leave the mc I stay in the last
     visited directory.

Slackware has two scripts that accomplish the directory change. Two versions are supplied for each, for Bash and for C-Shell.

Permissions should be 755.

Both are written with no shebang and have a trailing line. I'm not sure if Debian still defaults to something other than Bash, you may have to add a shebang calling Bash (#! /bin/bash) to make these work on a Debian system.

The first is '' which located in "/etc/profile.d" This directory contains the Slackware login scripts. Debian may place these scripts somewhere else. This simply defines an alias, I find it convenient to add mc switches here rather than the command line.

The second is '' located in "/usr/share/mc/bin/"
This is how mc is set to remember the new directory on exit. MC used to remember which pane was active on exit, but this capacity was removed for some reason. MC now opens always with the left pane active, swapping panes if the right pane was active on exit.

 ------- BEGIN '/etc/profile.d/' -------
alias mc='. /usr/share/mc/bin/'

 ------- END -------

 ------- BEGIN "" with my switches -------
alias mc='. /usr/share/mc/bin/ -d -X'

 ------- END -------

 ------- BEGIN '/usr/share/mc/bin/' -------
MC_USER=`id | sed 's/[^(]*(//;s/).*//'`
/usr/bin/mc -P "$MC_PWD_FILE" "$@"

if test -r "$MC_PWD_FILE"; then
        MC_PWD="`cat "$MC_PWD_FILE"`"
        if test -n "$MC_PWD" && test -d "$MC_PWD"; then
                cd "$MC_PWD"
        unset MC_PWD

rm -f "$MC_PWD_FILE"
unset MC_USER

 ------- END -------


 ... on an island, somewhere in the Pacific ...

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]