View previous topic :: View next topic |
Author |
Message |
Linubie Guru
Joined: 11 Jun 2004 Posts: 381
|
Posted: Fri Oct 11, 2024 1:21 pm Post subject: midnight commander doesn't stay in directory |
|
|
I've added
Code: | alias mc='. /usr/libexec/mc/mc-wrapper.sh' |
to /etc/bash/bashrc
opening KDE Konsole and execute:
Code: | alias mc='. /usr/libexec/mc/mc-wrapper.sh' |
and then
neither works.
I need to change the directories with cd. _________________ Mircosoft software is like having sex with a stranger, you always have to be careful not to get infected with something... |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22509
|
Posted: Fri Oct 11, 2024 3:29 pm Post subject: |
|
|
From the output you provided, it looks like the alias mc should be invoked. What do you see that makes you think it did not work? |
|
Back to top |
|
|
Banana Moderator
Joined: 21 May 2004 Posts: 1680 Location: Germany
|
|
Back to top |
|
|
Linubie Guru
Joined: 11 Jun 2004 Posts: 381
|
Posted: Fri Oct 11, 2024 5:55 pm Post subject: |
|
|
Well opening mc, changing directories and quit mc I am in the same directory, in that I began before starting mc ;O)
Let's say I started mc in directory /usr change the directory within mc to /etc and after quiting mc I am still in /usr instead of /etc.
This is what /usr/libexec/mc/mc-wrapper.sh should accomplish. _________________ Mircosoft software is like having sex with a stranger, you always have to be careful not to get infected with something... |
|
Back to top |
|
|
Linubie Guru
Joined: 11 Jun 2004 Posts: 381
|
Posted: Fri Oct 11, 2024 6:05 pm Post subject: |
|
|
deleting
Code: | alias mc='. /usr/libexec/mc/mc-wrapper.sh' |
from /etc/bash/bashrc
and adding
Code: | . /usr/libexec/mc/mc.sh |
to ~/.bashrc
neither works for me
edit: And I restarted the PC ;O) _________________ Mircosoft software is like having sex with a stranger, you always have to be careful not to get infected with something... |
|
Back to top |
|
|
flexibeast Guru
Joined: 04 Apr 2022 Posts: 407 Location: Naarm/Melbourne, Australia
|
Posted: Fri Oct 11, 2024 10:54 pm Post subject: |
|
|
Looking at the source of /usr/libexec/mc/mc-wrapper.sh:
Code: | MC_USER=`whoami`
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 "$MC_PWD" != "$PWD" && test -d "$MC_PWD"; then
cd "$MC_PWD"
fi
unset MC_PWD
fi
rm -f "$MC_PWD_FILE"
unset MC_PWD_FILE
unset MC_USER |
what are the contents of `${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$` when mc is running? _________________ https://wiki.gentoo.org/wiki/User:Flexibeast |
|
Back to top |
|
|
Banana Moderator
Joined: 21 May 2004 Posts: 1680 Location: Germany
|
|
Back to top |
|
|
spica Guru
Joined: 04 Jun 2021 Posts: 326
|
Posted: Sat Oct 12, 2024 9:01 am Post subject: |
|
|
Linubie wrote: | I started mc in directory /usr change the directory within mc to /etc and after quiting mc I am still in /usr instead of /etc. |
Does this command create /tmp/mc_was_invoked_in_this_dir.txt ? backslash is to make sure it is not an alias Code: | \mc -P /tmp/mc_was_invoked_in_this_dir.txt |
What version of mc is installed? I observe the version app-misc/mc-4.8.30-r2 does not create the file, but app-misc/mc-4.8.32 does |
|
Back to top |
|
|
Linubie Guru
Joined: 11 Jun 2004 Posts: 381
|
Posted: Sat Oct 12, 2024 9:31 am Post subject: |
|
|
Banana wrote: | After looking into the files /usr/libexec/mc/mc.sh does set alias mc='. /usr/libexec/mc/mc-wrapper.sh' and checks for plain shell.
Another questions:
What shell do you use?
Is your ~/.bashrc sourced/executed? |
KDE Konsole - /bin/bash
Code: | ls ~/.bashrc
-rw-r--r-- 1 darfwas darfwas 575 11. Okt 19:58 /home/darfwas/.bashrc |
Code: | cat ~/.bashrc
# /etc/skel/.bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# Put your fun stuff here.
. /usr/libexec/mc/mc.sh |
Code: | \mc -P /tmp/mc_was_invoked_in_this_dir.txt |
Code: |
ls /tmp/mc_was_invoked_in_this_dir.txt
-rw------- 1 darfwas darfwas 4 12. Okt 11:26 /tmp/mc_was_invoked_in_this_dir.txt |
_________________ Mircosoft software is like having sex with a stranger, you always have to be careful not to get infected with something... |
|
Back to top |
|
|
|