다음 스크립트의 경우 예기치 않은 태그 "else" 근처에서 구문 오류가 발생합니다.

다음 스크립트의 경우 예기치 않은 태그 "else" 근처에서 구문 오류가 발생합니다.
    if ! [ $result1 -eq $SUCCESS ]; then

        # failed to get the status from 1st ssd try with the 2nd ssd, to identify the primary and secondary
        mount_diagnostic_partition_read_ssdStatus_file $by_id_2_new
        result2=`echo $?`

        # check the result, is the primary and secondary ssd identification done
        if ! [ $result2 -eq $SUCCESS ]; then

            # attempt 2 also failed to identify the primary and secondary
            # check is both attempt failure are due to mount
            if  [ $result1 -eq  $MOUNT_FAIL -a $result2 -eq $MOUNT_FAIL ]; then

                # ssd are there but unable to mount, so go out of ssd management and proceed with CFAST
                echo "Mount failed for both SSD's"
                ssd_logger "Mount failed for both SSD's"
                echo "So exiting detect_SSD'S fn"
                ssd_logger "So exiting detect_SSD'S fn"
                echo "Booting with CFAST"
                ssd_logger "Booting with CFAST"
                mkdir -p $CFAST_PATH
                echo "CFAST" > $CFAST_PATH/failoverstatus
                retval=$MOUNT_FAIL
                #setLogDirs "cfast"
                #exit 0
            fi

            # if primary and secondary ssd identification due to no ssd file then
            # consider the ssd which are detected in the order as primary and proceed,
            # create the ssd file and sync it at the end
            #ssd_logger "Coming out of detectSSD's "
            #return $retval
        else
            echo "Mounting Primary diagnostics partiton failed for $by_id_1_new and successfull for $by_id_2_new"
            ssd_logger "Mounting Primary diagnostics partiton failed for $by_id_1_new and successfull for $by_id_2_new"
            retval=$SSD_2_SUCCESS
        fi
    else    **#error line**
        echo "Mounting Primary diagnostics partiton was successfull for $by_id_1_new"
        ssd_logger "Mounting Primary diagnostics partiton was successfull for $by_id_1_new"

답변1

한 가지 빠진 것이 있습니다 fi. 3개가 있지만 if첫 번째 항목은 아무데도 닫히지 않습니다.

관련 정보