antior 在 佬们,问下Expect脚本如何输入方向键呢? 中发帖
我使用脚本
#!/usr/bin/expect -f
# auto-select.exp
spawn npm start
expect "Select proxy source:"
exp_send "Sending up arrow twice and enter\n"
send "\x1B\[A\x1B\[A\r" # Simulate up arrow key
# send "^[OA\033[A\r" # 将 `[` 转义 # Simulate up arrow key
expect "Enter the path to your proxy.txt file"
exp_send "Sending enter\n"
send "\r" # Simulate up arrow key
expect eof
结果报错
====================...