So I'm a freak, and I still use Pine for reading my email. Even weirder, I like to run Pine directly on the server in question, because it's way faster than using Imap. However, this is a little annoying when I want to look at some sort of attachment like a PDF or image, because I need to view it on the machine running my gui.
I wrote this little script to enable this, and it works well:
#!/usr/bin/perl
use strict;
use warnings;
use File::Temp qw(tempfile);
my ( $fh, $filename ) = tempfile();
print $fh $_ while <>;
seek $fh, 0, 0;
my $remote_host = ( split //, $ENV{SSH_CONNECTION} )[0];
system( 'scp', $filename, $remote_host . ':' . $filename );
system( 'ssh', $remote_host, 'DISPLAY=:0.0 gnome-open ' . $filename );
The fact that gnome-open just does the right thing makes this all very simple.
However, I just now realized that this won't work when I am connecting from a machine behind NAT. I think the trick might be to always connect to the remote machine with a reverse tunnel, and take advantage of that to make things work.
Offered without further comment (Score:1)
zssh [sourceforge.net].
Cute and disturbing (Score:2)
That doesn't quite do what my script does though. With my script, I can transfer the file and open the relevant viewer all in one command.
h
Re: (Score:1)
It should be possible to use the
hookcommand to achieve that, though. I admit I don’t know if it can actually be done, as I’ve only ever kept zssh on file as an “if I ever need to do that” sort of thing.It’s a blast from the past, aye?