I recently installed openSUSE 13.1 and set up the mc
in typical why by aliasing mc with mc-wrapper.sh
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 mc-wrapper.sh
script - the echo
commands.
MC_USER=`id | sed 's/[^(]*(//;s/).*//'`
MC_PWD_FILE="${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$"
/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
echo "will cd in : $MC_PWD"
cd $MC_PWD
echo $(pwd)
fi
unset MC_PWD
fi
rm -f "$MC_PWD_FILE"
unset 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?
source name_of_your_script
.