从shell(bash)脚本执行命令时,在用户提示中插入文本吗?

Cal*_*vin 1 bash scripting

我有一个执行另一个程序的bash脚本。该程序提示用户进行其他输入。问题是,如何从bash脚本自动执行该输入?

例如,s3cmd从我的脚本运行命令会提示我:

Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3
Access Key: _
Run Code Online (Sandbox Code Playgroud)

在我的shell脚本中,我将如何为访问密钥提示插入字符串,然后模拟“输入”密钥?

编辑:为清楚起见

Jon*_*ler 5

您通常会使用该expect命令,或者它的一种工作方式。现在看来,该代码可从SourceForge获得。