#!/bin/bash
# Bash commands go here
/usr/bin/expect - << EndMark
This is the expect script
expect commands go here
and here
until:
EndMark
# More bash commands go here.
exit 0
像这样的东西将允许我从 bash 中启动一个期望脚本。但是,当它到达更多 bash 命令部分时,它将停止期望进程(以及它生成的进程)是否有可能回到相同的期望脚本?
eg - Start expect script
- At a certain point leave the expect to bash operations
- return to the same expect script?
没有必要为了发出 shell 命令而离开 expect 进程 - 您可以在 expect 脚本中使用 system
命令。