Created
May 30, 2022 01:14
-
-
Save jarkkojs/b005d1e7bcd60fc432f2d7c0db787c06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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