I am logged into ssh to a university account from my home computer. Then I find a file that I want to copy onto my local system. So I open a new shell terminal and am about to use scp
to copy that file onto my system. But the path to the file on the system I am ssh
'ed into is long so I select it with the mouse and then paste it with the mouse into the other locally connected terminal.
What I would like to do is something along the lines of: feed the output of pwd
into a variable that is temporary and visible to all terminals even though I made it under the ssh
'ed terminal, or some other way that I can't think of.
Best Answer
The way to do that is to use an ordinary file or a named pipe.
Why not do the
scp
in the original terminal in the first place (even in the background)?If the host system uses
proc
, in the second terminal docd -P /proc/PID/cwd
then do yourscp
from.
(where PID is that of the shell which is in the cwd/pwd that you are interested in).