如何在Ctrl中发送Ctrl + a然后d
问题描述:
因此,我试图将外壳程序生成到远程服务器,然后使屏幕运行一些命令,然后通过执行以下操作从所述屏幕分离:
So I am trying to spawn a shell to a remote server then make a screen run some commands and then detach from said screen by doing:
#!/usr/bin/expect
set server [lindex $argv 0]
spawn s "$server"
expect "#" { send "screen -S test\r" }
expect "#" { send \someescapeheretoreplicate ctrl + a then d to tell screen to detach }
interact
但是我不知道这些转义序列是什么,所以无法查找它们的表.
But I have no idea what those escape sequences are called so am unable to look up a table of them or what not.
答
如果我记得:
send "\x01"; send "d"
其中 \ x01
是Ctrl-A的值
Where \x01
is the value of Ctrl-A