Hello, I'm trying to set up everything as I had in bash, the mc-wrapper
is one thing I cannot make work.

This is the code for the bundled mc-wrapper, I'm calling it in bash with
an alias: alias mc='. /usr/share/bin/mc-wrapper.sh'

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

MC ()
{
    mkdir -p $HOME/.mc/tmp 2> /dev/null
    chmod 700 $HOME/.mc/tmp
    MC=$HOME/.mc/tmp/mc-$$
    /usr/bin/mc -P "$MC"
    cd "`cat $MC`"
    rm -f "$MC"
    unset MC;
}

This makes mc left you on the last directory you were navigating
inside mc when it exits, pretty useful. All the magic is done by the
'-P' switch.

Now I don't know why the wrapper has the stuff twice, first it calls mc
and then it defines the function MC() wich is never called, so I ignored
it and went with the basic and simple stuff that I think should work,
so in fish I do this in my config.fish (which *is* being sourced):

    function mc
        set mctmpfile (tempfile)
        /usr/bin/mc -P $mctmpfile
        cd (cat $mctmpfile)
        rm -f $mctmpfile
        set mctmpfile
    end

But it doesn't work.
I checked also the csh version of the wrapper and it doesn't have the
double definition, so I guess the function definition is there for
example (maybe, who knows).

The thing that annoys me most is that using bash, and going to the
places where I'm supposed to find the file defined for the '-P' switch,
I don't find the file! But somehow it works. One can think that the file
is created upon exit, so that's why I cannot see it, but in fish, or
even from the command line, the file gets created instantly, the thing
is nothing is put inside it.

I tried from the command line '/usr/bin/mc -P /tmp/deleteme' and nothing
is to be found on /tmp/deleteme

I'm pretty lost now, anyone else uses mc? Or have an idea on where to
aim from here?
-- 
Fernando Canizo - http://muriandre.homelinux.org/~conan/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to