A
A
Alice2022-03-17 11:02:28
linux
Alice, 2022-03-17 11:02:28

Why am I getting syntax error: unexpected end of file?

I just started parsing the scripts, I can't figure out where this error comes from

#!/bin/bash
echo "Hello $USER, I suggest we play!" "Please enter a number"
num=$(( $RANDOM % 100 + 1))
echo $num
for var in 1, 2, 3, 4, 5
do
read n
if [ $n -eq $num ]; then
echo "You win! Bye :)"
break
elif [ $n -gt $num ]; then
echo "False," $USER", my number is less than this, try again"
else
echo "False, "$USER", my number is greater than this, try again"
fi
done
if [ $var -eq 5 ]; then
echo "You failed ha ha ha"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2022-03-17
@alisa_zak

At least here if is not closed

...
if [ $var -eq 5 ]; then
echo "Ты прориграл ха-ха-ха"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question