我正在尝试编写一个脚本来测试 telnet 连接。我在类似 qnx 6 的操作系统中使用 CP866 编码,并且需要完整的西里尔文期望的输出。 我期望的版本是5.33,tcl是8.3.5
拉丁语输出完全没有问题,但我得到的是问号而不是西里尔语。我做错了什么?一般情况下应该预期显示非拉丁输出吗? 顺便说一句,它有效。我可以打开telnet会话,只是输出不是我想要的
我的代码是:
#!/bin/sh
expect -c '
set timeout 5
spawn telnet 127.0.0.1
fconfigure $spawn_id -encoding cp866
expect {
-re "Имя пользователя:|Username:" {
send -- "root\r"
exp_continue
}
-re "Пароль:|Password:" {
send -- "12345678\r"
exp_continue
}
-re "Выполнен вход|Signed in" {
puts "-> Pass"
exit 0
}
timeout {
puts "-> Fail"
exit 1
}
}
'
我的输出:
??? ????????????: root
??????:
???????? ???? ? ???????: 17:28:49 02.10.2024 ?? /dev/ttyp0
也尝试添加
fconfigure stdout -encoding cp866
fconfigure stderr -encoding cp866