Parentheses usually group commands to a list which is executed in a subshell. For testing purposes, use the test command, to which [ is a synonym. man [:
. . .
Quote:
NOTE: your shell may have its own version of test and/or [, which usually supersedes the version described here. Please refer to
your shell's documentation for details about the options it supports.
After extracting, changing the permissions, and running your code this is the result:-
So before trying anything research what error report pertains to...
Line 8 reveals:-
Therefore somewhere in that line is your first error...
"if" is the command wanted and is adjoined to a parenthesis, (read RudiC's comment). Next try a space between the if and the parentesis. The same error occurs like this "elif" command at Line 11:-
So as the same error occurs in both the either your _brackets_ are wrong or the parts inside the _brackets_ are wrong.
Next modification after adding spaces between the commands and _brackets_ is to add spaces inside the _brackets_ like this...
If this does not work then make an assumption that the part inside the parentheses is OK and change your parentheses first to, say, these:-
Retry and VOILA, it works, (your code cleaned up):-
By doing a little process of elimination you woild have gotten the result by yourself. It just needs someone to show that process of elimination.