line 33: if [$? ne 0]
line 33: if [ $? -ne 0 ]
that is you need spaces to separate the expression from the opening and closing brackets. Moreover the integer comparison operators always begin with a hyphen. Just take in mind that [ is both a bash built-in and a command. You can verify this assertion on your system by means of
This means that the syntax common to all the linux command is applied, that is <command name><space><argument><space><argument>...
and so on. This explains the mandatory presence of the spaces. Instead, the closing bracket ] is the mandatory last command argument