Unix & Linux: Syntax Error: unexpected end of file Bash script
Channel: Roel Van de Paar
Date: 2020-08-13

Unix & Linux: Syntax Error: unexpected end of file Bash script


The Question: I am trying to create an spritz app. Everything was working fine, but since
yesterday I keep getting this error:
 ./spritz: line 176: syntax error: unexpected end of file
I have checked the script file and everything seems perfect. I am confused, I
have an if statement at last and it looks correct! Here is the last portion:
#checks if speed is 150
157 if [[ $2 -eq 150 ]];
158 then
159 starttime=$SECONDS
160 FS=$'\n'
161 for j in `grep --color=always -iP '\b[^aeiou\s]*[aeiou][^aeiou\s]*\K
[aeiou]' $1`;
162 do
163 #Reads the text file in the centre of the screen
164 echo "
___________________"
165 echo "
$j";
166 echo "
___________________"
167 echo "
Speed 150 wpm"
168 sleep 0.9;
169 clear;
170 done
171 endtime=$(($SECONDS - $starttime))
172 echo "You read $words_read words in $endtime seconds!"
173 exit 8
174 fi
What could cause that error?

Solutions: Please watch the whole video to see all solutions, in order of how many people found them helpful

With thanks & praise to God, and with thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free-music | Images: https://stocksnap.io/license & others | With thanks to user Scott Pearce (https://unix.stackexchange.com/users/108416), user Jeff Schaller (https://unix.stackexchange.com/users/117549), user Janis (https://unix.stackexchange.com/users/102438), and the Stack Exchange Network (http://unix.stackexchange.com/questions/193165). Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything is amiss at Roel D.OT VandePaar A.T gmail.com.