gaaara G
gaaara G

Reputation: 15

BASH Linux : syntax error « ;; »

i have a syntax error « ;; »

Syntax error near unexpected token « ;; »

my code

#!/bin/bash
# Bash Menu

clear

echo "Decryptor"

PS3='entrez votre chois: '
options=("update" "decryptor" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "update")
            php updatekey.php
            break
            ;;
        "decryptor")
           #Nom de la video
           read -p "Nom de la série  : " name
           #detection du fichier .png
           find . -name "*.png" | while read line
           oname="$(basename "${line}" .png)"
           #décryption du fichier png
           php -e AES.class.php "${oname}".png
           #on change le nom du fichier
           mv "${oname}".ass "${name}".ass

           read -p "voulez vous télécharger la video (Y/N)? "
           [ "$(echo $REPLY | tr [:upper:] [:lower:])" == "y" ] || exit

           read -p "entrez liens   :" src
           read -p "liens vod" vod

           rtmpdump -v -T '567ghgh' -r "$vod" -a "vod" -f "WIN 13,0,0,182" -W "http://yoyo.com/components/yoyo.swf" -p  "http://yoyo.com" -y "mp4:$src" -o "$name.mp4"
             break
            ;;
        "Quit")
            break
            ;;
        *) echo invalid option;;
    esac
done

is part of code with error why I get an error I modified the script a bit and this part to not move and I now have an error

What can be the cause

thank you :)

Upvotes: 0

Views: 88

Answers (1)

tripleee
tripleee

Reputation: 189377

Line 21 contains the beginning of an incomplete while statement. The parser only notices because ;; is illegal when it's still looking for the do.

find stuff | while read line
    echo you can have multiple commands here --
    echo the exit code of the expression is
    echo examined by '"while"'
do
    echo ... Body of while loop
done

Your code lacks the do and done parts, and it's unclear to Bash (and to us) where they should go.

Upvotes: 2

Related Questions