如何使用脚本自动回答问题?

时间:2019-07-10 15:33:08

标签: python automation scripting

我有一个脚本,我想从另一个脚本开始,该脚本会自动对脚本中提出的问题回答是。

我想像每2小时运行一次自动化python脚本来启动脚本并回答问题

UPDATE_SCRIPT_ANSWER=2;
while [[ "$UPDATE_SCRIPT_ANSWER" -eq 2 ]]; do
    read -p "${TXT_EXECUTION_MECHANISM_SCRIPT_UPDATE_ANSWER} ([y]es/[n]o) " UPDATE_SCRIPT_ANSWER <&5

    if [[ -n "$UPDATE_SCRIPT_ANSWER" ]] && [[ "$UPDATE_SCRIPT_ANSWER" != "y" ]] && [[ "$UPDATE_SCRIPT_ANSWER" != "yes" ]] && [[ "$UPDATE_SCRIPT_ANSWER" != "n" ]] && [[ "$UPDATE_SCRIPT_ANSWER" != "no" ]]; then
        echo -en "${SCurs}${TXT_EXECUTION_MECHANISM_SCRIPT_UPDATE_ANSWER_ERROR}";
        echo -e "${RCurs}${MCurs}[ ${Red}ERROR ${RCol}]";
        UPDATE_SCRIPT_ANSWER=2;
    elif [[ "$UPDATE_SCRIPT_ANSWER" == "y" ]] || [[ "$UPDATE_SCRIPT_ANSWER" == "yes" ]]; then
        UPDATE_SCRIPT_ANSWER=1;
    elif [[ "$UPDATE_SCRIPT_ANSWER" == "n" ]] || [[ "$UPDATE_SCRIPT_ANSWER" == "no" ]]; then
        UPDATE_SCRIPT_ANSWER=0;
    fi
done

0 个答案:

没有答案