Skip to content

Instantly share code, notes, and snippets.

@jarkkojs
Created May 30, 2022 01:14
Show Gist options
  • Save jarkkojs/b005d1e7bcd60fc432f2d7c0db787c06 to your computer and use it in GitHub Desktop.
Save jarkkojs/b005d1e7bcd60fc432f2d7c0db787c06 to your computer and use it in GitHub Desktop.
function mc
set MC_USER (whoami)
if set -q TMPDIR
set MC_PWD_FILE "$TMPDIR/$MC_USER/mc.pwd.$fish_pid"
else
set MC_PWD_FILE "/tmp/mc-$MC_USER/mc.pwd.$fish_pid"
end
/usr/bin/mc -P "$MC_PWD_FILE" "$argv"
if test -r "$MC_PWD_FILE"
set MC_PWD (cat $MC_PWD_FILE)
if test -n "$MC_PWD" && test "$MC_PWD" != "$PWD" && test -d "$MC_PWD"
cd "$MC_PWD"
end
set -e MC_PWD
end
rm -f "$MC_PWD_FILE"
set -e MC_PWD_FILE
set -e MC_USER
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment