mc-wrapper does not exit to MC_PWD directory

by Arkonix   Last Updated February 14, 2018 23:01 PM

I recently installed openSUSE 13.1 and set up the mc in typical why by aliasing mc with to have it exit into the last working directory in mc instance. However this does not seem to be working. I tried to debug the script - the echo commands.

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

if test -r "$MC_PWD_FILE"; then
        MC_PWD="`cat "$MC_PWD_FILE"`"
        if test -n "$MC_PWD" && test -d "$MC_PWD"; then
                echo "will cd in : $MC_PWD"
                cd $MC_PWD
                echo $(pwd)
        unset MC_PWD

rm -f "$MC_PWD_FILE"
echo $(pwd)

To my surprise, mc-wrapper-sh does change the directory and is in the directory before exiting but back in bash prompt the working directory is the one from which the script was invoked.

Can it be that some bash settings is required for this to work?

Answers 1

Using answer above working solution for bash shell is this:

alias mc='source /usr/lib/mc/'


alias mc='. /usr/lib/mc/'
Igor Ostroumov
Igor Ostroumov
February 14, 2018 22:40 PM

Related Questions

Fast navigation in Midnight Commander Shell link mode

Updated October 15, 2018 13:01 PM

Attach to Midnight Commander session

Updated March 21, 2019 01:01 AM

How to right-click to paste in mcedit

Updated July 05, 2017 03:01 AM

Midnight Commander use macro in panelize

Updated July 08, 2017 21:01 PM

Midnight Commander Editor status line decryption

Updated December 11, 2018 14:01 PM