Force Midnight Commander to exit in current directory

I have some Gentoo systems that have mc installed, but it’s default behaviour is to exit to the directory it was run from. I wanted to change this, because most of the time I’m using it to navigate the filesystem and then after exiting mc I want to be dropped to the directory I have navigated to. To achieve this you can issue this little script which will force Midnight Commander to exit in this directory.

mkdir /etc/profile.d
cat > /etc/profile.d/mc-chdir.sh << EOF
#!/bin/sh
if [ /usr/libexec/mc/mc.sh ]; then
    . /usr/libexec/mc/mc.sh
fi
EOF
chmod 775 /etc/profile.d/mc-chdir.sh

 

About Wolverine

If you are looking for IT consultant, let me know! karol at karoltomala dot REMOVE com Just remove the REMOVE word from the e-mail above!
This entry was posted in Random and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *