Re: midnight commander internal cd in scripts



On Fri, 22 Feb 2013 20:16:17 +0200 Elad Rom wrote:
Is there a way to cd into a folder (be it ssh, ftp or local folders)
from an existing instance of midnight commander through a shell script?

Example:
Inside an open MC instance, in my home folder, there is a file called "somessh.sh".
When I hit enter on this executable, I want mc to cd into the directory I specify inside the file (E.g. 
~/Downloads)
as if I'm using the cd in the mini-command line or via quick cd.

When you run shell script, you run new shell which is child process of MC.
When you do cd in the script, you change working directory of that child
shell. Working directory of parent is unchanged. You unable to change working
directory of parent from child.

You have to use the "source" built-in shell command to run script in current
process context. This allows you change current directory from script.

-- 
Andrew


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]