erro de sintaxe fi e fim de arquivo inesperado [fechado]

-2
#!/bin/bash
echo "Do you want to Login or Sign Up?"

read ans

if [ "$ans" = "Sign Up" ]

then
echo "You are creating a account"
echo "Create a Username"
read ipr4
clear
echo "Create a Password"
read pwd
touch $pwd &
touch $ipr4 &
read ip
else
clear
echo "Type in your Username"
read pwed
clear

if [ -f $pwed ]; then
echo "Type in your password"
read pass
clear

if [ -f $pass ]; then
echo "Choose a application (To run the proggramm of your choise just type in the name of the proggramm)"
echo " | Ecryption | Chat | Spamming Chat | Quiz | "
read act
if [ "$act" == "Encryption" ]
then
     echo "Do you want to encrypt or decrypt message (Type in encrypt to encrypt a message in base64. Type in decrypt to decrypt a message that was encrypted in base 64)"
read ans
if [ "$ans" = "encrypt" ]
then

     echo "Please enter your message"
read enc
     echo "Your encrypted message is:"
     echo  -n $enc | base64
    echo "Please enter the message that you want to decipher"
read dec
    echo "Your deciphered message is:"
    echo -n $dec | base64 -D
    echo " "
if [ "$act" == "Chat" ] then
echo "Want to be a the Host (yes/no)"
read y

if [ "$y" ==  "yes" ]
then

clear
echo "Which port"
read port
clear
echo "You are on port: $port"
nc -l $port
else
if [ "$y" == "no" ]
then
clear
echo "Which port do you want to chat on"
read p2
echo "What is the listeners IPv4"
read ipi4
clear
echo "You are chatting to $ipi4 on Port: $p2"
nc $ipi4 $p2
else
if [ "$act" == "Spamming Chat"]
then
clear
echo "Want to be a listener (yes/no)"
read y
if [ "$y" ==  "yes" ]
then
clear
echo "Which port"
read port
clear
echo "You are on port: $port"
echo "Which message do you want to spam"
read spamm
echo "You are chatting to $ipv4 on Port: $p2"
mkfifo fifo_filename
nc -l $p2 <fifo_filename &

exec 3>fifo_filename
while true
do
        echo "$spamm"
        sleep 0.001
done >&3
if [ "$act" == "Quiz" ]
then
clear
  echo "Hello this is a test"
  echo "You will be asked 3 questions and each one has two options to choose from.
There is just one correct answer for each question."

  echo "Q1: Is black a colour (yes or no)"
read q1
if [ "$q1" = "no" ]
then
   q1=1
   echo "Correct,you recieved $q1 point"
else
   q1=0
   echo "Wrong you recieved $q1 points"


  echo "Q2:Who painted the Mona Lisa (Aristotle or Da Vinci)"
read q2
if [ "$q2" = "Da Vinci" ]
then
   q2=1
   echo "Correct you recieved $q2 point"
if [ "q2" -ne "Da Vinci" ]
then
  q2=0
  echo "Wrong you recieved $q2 points"

 echo "You now have $(($q1+$q2)) points"

 echo "Q3:Who invented the seatbelt (Volvo or Porsche)"
if [ "$q3" = "Volvo" ]
then
  q3=1
 echo "Correct you recieved $q3 point"
if [ "$q3" -ne "Volvo" ]
then
 q3=0
 echo "Wrong you unfortunately recieved $q3 points"
sleep 4
clear
sleep 2
echo "Congratulations you scored  $(($q1+$q2+$q3))/3"
fi
fi
fi
else
if [ -f -ne $pass ];then
clear
sleep 2
echo "login failed"
echo "4 fi down"
fi
fi
fi
fi
fi
fi
fi
fi

Portanto, este pedaço de código deve ser um sistema básico que permita usar vários programas incorporados no código. Ele sempre me dá dois erros fi sintaxe erro e quando eu corrijo o código que me dá o alerta final inesperado do arquivo e que continua e continua. Alguém pode chegar a uma solução para este problema.

ijndkgeo
fonte

Respostas:

7

Eu conto 17 if s e apenas 11 fi s. Feche o if s com fi s.

Recue também o código corretamente.

fejyesynb
fonte