0

I need to script the installation of a number of products on Redhat Linux I am installing from previously downloaded tar files that each contain their own specific install.sh. My problem is that by executing the install.sh scripts a number of questions are asked such as ...
a). Accept license
b). set default path(s)
c). do i wish to start service
etc...
Can Bash detect these questions and respond correctly? or do i require another linux based product/function?
For windows based installs i have used AutoItScript. What are my options on Linux Redhat?

4

1 回答 1

1

要确定脚本是否支持任何命令行选项,您可以:

  • 阅读软件的自述文件,如果有的话。这应该解释任何选项。
  • install.sh阅读脚本的顶部。通常选项至少在那里列出。
  • 阅读代码本身,这可能是很多工作。

一旦确定脚本不支持选项,自动执行此操作的标准方法是使用expect脚本。例如,请参阅使用期望脚本自动化 install.sh 脚本

根据安装脚本的工作方式,您可以通过标准输入向它发送命令。例如,如果您按Tab一次,然后按 ,Enter然后y再按一次Enter,您可以尝试以下操作:

printf %s $'\t\ny\n' | ./install.sh
于 2013-06-24T10:55:24.170 回答