如何在bash中逐行执行if语句

时间:2019-07-18 11:35:02

标签: bash

如何在bash中逐行执行if语句?

for i in $(cat $install_script)
do
    if [ "$i" = "$check" ]; then
        count=$((count+1))
        echo whiptail --title "Install SmartBoard" --yesno "${scripts_name[$count]}" 7 $((${#scripts_name[$count]} + 5))
        if (( $? == 0 )); then
            skip=false
        else
            skip=true
        fi
    fi
    if [ "$i" == "$check wifi" ]; then
        break
    fi
    if [ $skip == true ]; then
        continue
    else
        sh -c $i ## process line by line
    fi
done

错误!!

sh: 1: Syntax error: end of file unexpected (expecting "then")

sh: 1: Syntax error: "then" unexpected

sh: 1: Syntax error: "else" unexpected

sh: 1: Syntax error: "fi" unexpected

我的英语不好,所以如果我的帖子不礼貌,抱歉。 :(

0 个答案:

没有答案