diff options
Diffstat (limited to 'source/ap/mc/profile.d/mc-wrapper.sh')
-rwxr-xr-x | source/ap/mc/profile.d/mc-wrapper.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/ap/mc/profile.d/mc-wrapper.sh b/source/ap/mc/profile.d/mc-wrapper.sh new file mode 100755 index 000000000..36db15747 --- /dev/null +++ b/source/ap/mc/profile.d/mc-wrapper.sh @@ -0,0 +1,14 @@ +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 + cd "$MC_PWD" + fi + unset MC_PWD +fi + +rm -f "$MC_PWD_FILE" +unset MC_PWD_FILE |