linux - else 字符串匹配在 expect 中

标签 linux shell expect

我想对 telnet 使用 expect 发送命令后 它可能会返回不同的结果 让我说,像以下3种可能性

1 successful
2 normal
3 there are something wrong...blabla
  you can refer to ....blabla


expect{
   "successful" {}
   "normal" {} 
   #here, for the third possibility, I want to use something like "else", so what should I put here? thanks!
}

最佳答案

您要查找的关键字是default

expect{
   "successful" {}
   "normal" {} 
   default {}
}

关于linux - else 字符串匹配在 expect 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13982310/

相关文章:

c - 在 C 应用程序中挂载带有 ntfs-3g 的设备

linux - 选择并复制 N 行文件

c - 在 execlp 调用期间休眠以避免输出 'lag'?是否可以?

tdd - 什么时候该期待什么时候该 stub ?

linux - 如何在 Expect 脚本中返回生成的进程退出代码?

c - 如何获取以太网设备列表

java - 在 Linux 2 中用 java 编译 Cplex

perl - 将一个文件拆分成多个文件

linux - bash/awk 脚本比较两个不同文件夹中所有文件的内容

linux - 使用 expect 脚本自动化包含多个文件的 SCP