Please post scripts and other source code in [code] tags. This vastly improves readability by displaying with a fixed width font and preserving whitespace.
The 1. 2. 3. 4. beginnings to the lines are for what purpose? Are these supposed to be comments? If so you should start the line with a #, else you will get messages like this:
Code:
1.: not found [No such file or directory]
The syntax of the if statement on the line starting with "4." is all wrong (never mind the fact that the 4. will make the if statement useless). You seem to have many "(( ... ))" when you should have "[[ ... ]]". That it runs on Solaris is a surprise - as far as I can tell this is not valid syntax.