Skip to content

Instantly share code, notes, and snippets.

@halicki
Last active March 26, 2024 17:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save halicki/58cedaf90f3e85277a799cef8217fc72 to your computer and use it in GitHub Desktop.
Save halicki/58cedaf90f3e85277a799cef8217fc72 to your computer and use it in GitHub Desktop.
Midnight commander wrapper script for the fish shell
function mc
set SHELL_PID %self
set MC_PWD_FILE "/tmp/mc-$USER/mc.pwd.$SHELL_PID"
/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"
and test -d "$MC_PWD"
cd (cat $MC_PWD_FILE)
end
rm $MC_PWD_FILE
end
end
@OMedicks
Copy link

Thank you!

@azlan
Copy link

azlan commented Jul 27, 2022

    if not test -d "/tmp/mc-$USER"
        mkdir -p "/tmp/mc-$USER"
    end

Check for directory first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment