← 返回命令列表

Linux command

autoexpect 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

autoexpect

Example

autoexpect [command]

Example

autoexpect -f [path/to/file] [command]

Use prompt mode

autoexpect -p [command]

Use conservative mode

autoexpect -c [command]

说明

autoexpect watches an interactive session and generates an Expect script that can replay the session automatically. It records user input and program responses, creating a script suitable for automating repetitive interactive tasks. The generated script is saved as script.exp by default. This script can be modified and reused to automate the recorded interaction.

参数

-f _file_
Save the generated script to the specified file instead of script.exp.
-p
Enable prompt mode. Autoexpect only matches the last line of program output (usually the prompt), making scripts less sensitive to output changes.
-P _key_
Define a key to toggle prompt mode on and off during the session.
-c
Enable conservative mode. Autoexpect pauses briefly (one tenth of a second) before sending each character, improving reliability on slow systems.
-C _key_
Define a key to toggle conservative mode on and off during the session.
-Q _key_
Define a quote character to enter characters that autoexpect would otherwise consume as toggle keys.
-quiet
Disable informational messages produced by autoexpect.

FAQ

What is the autoexpect command used for?

autoexpect watches an interactive session and generates an Expect script that can replay the session automatically. It records user input and program responses, creating a script suitable for automating repetitive interactive tasks. The generated script is saved as script.exp by default. This script can be modified and reused to automate the recorded interaction.

How do I run a basic autoexpect example?

Run `autoexpect` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -f _file_ do in autoexpect?

Save the generated script to the specified file instead of script.exp.