gpt4 book ai didi

expect - 如何在 Expect 中发送 Ctrl + a 然后 d

转载 作者:行者123 更新时间:2023-12-02 07:27:00 24 4
gpt4 key购买 nike

所以我试图为远程服务器生成一个 shell,然后让屏幕运行一些命令,然后通过执行以下操作从所述屏幕分离:

#!/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

但我不知道这些转义序列叫什么,所以我无法查找它们的表格或类似的东西。

最佳答案

如果我记得:

send "\x01"; send "d"

其中 \x01 是 Ctrl-A 的值

关于expect - 如何在 Expect 中发送 Ctrl + a 然后 d,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27050473/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com