ssh "!command" escape sequence - does it work?

Karl Auer kauer at biplane.com.au
Fri Sep 11 10:01:54 UTC 2020


On Fri, 2020-09-11 at 09:13 +0100, Chris Green wrote:
> Yes, I do have that set and have checked by setting LocalCommand as
> well.  Reading parts of the documentation seems to suggest that
> '!command' actually executes the command set in LocalCommand with new
> parameters - but I can't make that happen either.

Yes -f you do ~C then h[enter] or ?[enter] it mentions a command
"!args".

Haven't spent long on it but it is a mystery to me, too.

Here are my adventures so far, tantalising!

myhost: ~$ ssh -o LocalCommand="ls" otherhost
[file listing of my home directory is output]
otherhost:~$ [press ~C]
ssh> !/ [enter]
/bin/bash: /: Is a directory
[enter]
otherhost:~$ [press ~C]
ssh> echo "Boo" [enter]
Invalid command.
[enter]
otherhost:~$ [press ~C]
ssh> !echo boo
[enter]
otherhost:~$ [press ~C]
ssh> !-la
/bin/bash: -c: option requires an argument
[enter]
otherhost:~$ exit

So I dunno what's going on. Except that LocalCommand  is executed
locally, as soon as the connection to otherhost succeeds.

Also tried CTL-D instead of enter, but that just exited the shell.

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer

GPG fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170
Old fingerprint: 8D08 9CAA 649A AFEF E862 062A 2E97 42D4 A2A0 616D







More information about the ubuntu-users mailing list