【问题标题】:How to select an option automatically from a prompt message in shell script?如何从 shell 脚本的提示消息中自动选择一个选项?
【发布时间】:2017-02-14 07:15:52
【问题描述】:

当我手动运行我的脚本时,它会提示选择 YES 或 NO 的消息。我在shell脚本中自动化这部分,如何自动选择YES

script.sh - 如果我运行它,它应该默认选择 YES

【问题讨论】:

  • man yes .....

标签: linux shell rhel


【解决方案1】:

很简单,我只是简单地回声

script.sh - 主脚本

#!/bin/bash
some_process
echo YES | process

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-09
    • 1970-01-01
    • 1970-01-01
    • 2021-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-17
    相关资源
    最近更新 更多