dimanche 24 décembre 2017

Bash, syntax error: 'elif' unexpected after elif line

I googling about an hour to find why my bash script is error and i feel my brain is ready to explode cause no answers, please help me

dtc=$(df /cache | awk '{print $4}' | awk 'NR==2')
    if [ "$dtc" -gt "196608" ]; then
        echo -ne "|         |  0%|         |\r"
        su -c "/system/0211/installer/swap/0211swaptocache192mb.sh"
        sleep 0.8
        echo -ne "|>>>>>>   | 30%|         |\r"
        mkswap /cache/0211swap.img
        swapon -p 1 /cache/0211swap.img
        echo 100 >  /proc/sys/vm/swappiness
        sleep 0.8
        echo -ne "|>>>>>>>>>| 55%|>        |\r"
        cp /system/0211/installer/swap/0211swapon /system/etc/init.d/0211swapon
        sleep 0.8
        echo -ne "|>>>>>>>>>|100%|>>>>>>>>>|\r"
        chmod 777 /system/etc/init.d/0211swapon
        sleep 1
        echo -ne "|>>>>>>>>>|Done|>>>>>>>>>|\n"
        sleep 0.8
        echo "If nothing wrong, your Swap is 192MB and should active"
        sleep 0.8
        else
        echo "/cache partition: not enough space"
        sleep 0.8
    elif [ "$dtc" -gt "163840" ]; then
        echo -ne "|         |  0%|         |\r" #this is the error
        su -c "/system/0211/installer/swap/0211swaptocache160mb.sh"
        sleep 0.8
        echo -ne "|>>>>>>   | 30%|         |\r"
        mkswap /cache/0211swap.img
        swapon -p 1 /cache/0211swap.img
        echo 100 >  /proc/sys/vm/swappiness
        sleep 0.8
        echo -ne "|>>>>>>>>>| 55%|>        |\r"
        cp /system/0211/installer/swap/0211swapon /system/etc/init.d/0211swapon
        sleep 0.8
        echo -ne "|>>>>>>>>>|100%|>>>>>>>>>|\r"
        chmod 777 /system/etc/init.d/0211swapon
        sleep 1
        echo -ne "|>>>>>>>>>|Done|>>>>>>>>>|\n"
        sleep 0.8
        echo "If nothing wrong, your Swap is 160MB and should active"
        sleep 0.8
    fi

Can someone please help me? 'elif' unexpected but the error is at the line after the elif

Aucun commentaire:

Enregistrer un commentaire