Merge branch '3205_eta'
[midnight-commander.git] / contrib / mc-wrapper.sh.in
blob3d929b34852f01cccfea8ffa5df38d6595ff188f
1 if test -n "$MC_TMPDIR"; then
2 MC_PWD_FILE="`mktemp "${MC_TMPDIR}/mc.pwd.XXXXXX"`"
3 elif test -n "$TMPDIR"; then
4 MC_PWD_FILE="`mktemp "${TMPDIR}/mc.pwd.XXXXXX"`"
5 else
6 MC_PWD_FILE="`mktemp "/tmp/mc.pwd.XXXXXX"`"
7 fi
9 @bindir@/mc -P "$MC_PWD_FILE" "$@"
11 if test -r "$MC_PWD_FILE"; then
12 MC_PWD="`cat "$MC_PWD_FILE"`"
13 if test -n "$MC_PWD" && test "$MC_PWD" != "$PWD" && test -d "$MC_PWD"; then
14 cd "$MC_PWD" || true
16 unset MC_PWD
19 rm -f "$MC_PWD_FILE"
20 unset MC_PWD_FILE