diff --git a/contrib/mc-wrapper.csh.in b/contrib/mc-wrapper.csh.in index 45ef98116..1eca8e7b7 100644 --- a/contrib/mc-wrapper.csh.in +++ b/contrib/mc-wrapper.csh.in @@ -10,7 +10,7 @@ endif if (-r "$MC_PWD_FILE") then setenv MC_PWD "`cat '$MC_PWD_FILE'`" - if ( -d "$MC_PWD" ) then + if ("$MC_PWD" != "$cwd" && -d "$MC_PWD") then cd "$MC_PWD" endif unsetenv MC_PWD diff --git a/contrib/mc-wrapper.sh.in b/contrib/mc-wrapper.sh.in index 2791d9e97..3905be480 100644 --- a/contrib/mc-wrapper.sh.in +++ b/contrib/mc-wrapper.sh.in @@ -4,7 +4,7 @@ MC_PWD_FILE="${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$" if test -r "$MC_PWD_FILE"; then MC_PWD="`cat "$MC_PWD_FILE"`" - if test -n "$MC_PWD" && test -d "$MC_PWD"; then + if test -n "$MC_PWD" && test "$MC_PWD" != "$PWD" && test -d "$MC_PWD"; then cd "$MC_PWD" fi unset MC_PWD