Support command in mosh wrapper script
This commit is contained in:
@@ -21,6 +21,8 @@ mosh \- mobile shell with roaming and intelligent local echo
|
|||||||
.B mosh
|
.B mosh
|
||||||
.RI [ options ]
|
.RI [ options ]
|
||||||
[user@]host
|
[user@]host
|
||||||
|
[--]
|
||||||
|
[command...]
|
||||||
.br
|
.br
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBmosh\fP (mobile shell) is a remote terminal application that
|
\fBmosh\fP (mobile shell) is a remote terminal application that
|
||||||
@@ -63,6 +65,10 @@ between 60000 and 61000, but allows the user to request a particular
|
|||||||
UDP port instead.
|
UDP port instead.
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
.B \fIcommand\fP
|
||||||
|
Command to run on remote host. By default, \fBmosh\fP executes a login shell.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-\-client=\fIPATH\fP
|
.B \-\-client=\fIPATH\fP
|
||||||
path to client helper on local machine (default: "mosh-client")
|
path to client helper on local machine (default: "mosh-client")
|
||||||
|
|||||||
+8
-3
@@ -37,7 +37,7 @@ my $help = undef;
|
|||||||
my $version = undef;
|
my $version = undef;
|
||||||
|
|
||||||
my $usage =
|
my $usage =
|
||||||
qq{Usage: $0 [options] [user@]host
|
qq{Usage: $0 [options] [user@]host [--] [command]
|
||||||
--client=PATH mosh client on local machine
|
--client=PATH mosh client on local machine
|
||||||
(default: "mosh-client")
|
(default: "mosh-client")
|
||||||
--server=PATH mosh server on remote machine
|
--server=PATH mosh server on remote machine
|
||||||
@@ -150,11 +150,12 @@ if ( defined $fake_proxy ) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( scalar @ARGV != 1 ) {
|
if ( scalar @ARGV < 1 ) {
|
||||||
die $usage;
|
die $usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $userhost = $ARGV[ 0 ];
|
my $userhost = shift;
|
||||||
|
my @command = @ARGV;
|
||||||
|
|
||||||
# Run SSH and read password
|
# Run SSH and read password
|
||||||
my $pty = new IO::Pty;
|
my $pty = new IO::Pty;
|
||||||
@@ -176,6 +177,10 @@ if ( $pid == 0 ) { # child
|
|||||||
push @server, ( '-p', $port_request );
|
push @server, ( '-p', $port_request );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( scalar @command > 0 ) {
|
||||||
|
push @server, ( '--', @command );
|
||||||
|
}
|
||||||
|
|
||||||
exec 'ssh', '-S', 'none', '-o', "ProxyCommand=$0 --fake-proxy -- %h %p", '-t', $userhost, '--', @server;
|
exec 'ssh', '-S', 'none', '-o', "ProxyCommand=$0 --fake-proxy -- %h %p", '-t', $userhost, '--', @server;
|
||||||
die "Cannot exec ssh: $!\n";
|
die "Cannot exec ssh: $!\n";
|
||||||
} else { # server
|
} else { # server
|
||||||
|
|||||||
Reference in New Issue
Block a user