次のスクリプトでは、予期しないタグ「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最初の項目はどこにも閉じません。

おすすめ記事