mc/contrib/mc-wrapper.sh.in
Andrew Borodin f57daa1678 Ticket #3355: mc-wrapper: don't cd to the same directory.
This would make a subsequent "cd -" more convenient. If you don't alter
the directory in mc, after exiting a "cd -" does nothing, whereas it
could take you to the actual previous directory.

Thanks Egmont Koblinger <egmont@gmail.com> for the initial patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00

16 lines
334 B
Bash

MC_USER=`whoami`
MC_PWD_FILE="${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$"
@bindir@/mc -P "$MC_PWD_FILE" "$@"
if test -r "$MC_PWD_FILE"; then
MC_PWD="`cat "$MC_PWD_FILE"`"
if test -n "$MC_PWD" && test "$MC_PWD" != "$PWD" && test -d "$MC_PWD"; then
cd "$MC_PWD"
fi
unset MC_PWD
fi
rm -f "$MC_PWD_FILE"
unset MC_PWD_FILE
unset MC_USER