如何在Ctrl中发送Ctrl + a然后d [英] How to send Ctrl + a then d in Expect

查看:84
本文介绍了如何在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

这篇关于如何在Ctrl中发送Ctrl + a然后d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆