Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/tetrac2/public_html/smf_forum/Sources/Load.php(225) : runtime-created function on line 3
Syntax Error: word unexpected ( expected some word)
TETRA - Tech Teams for Resourceful Applications
December 16, 2017, 01:13:46 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Syntax Error: word unexpected ( expected some word)  (Read 1951 times)
glforbes
Administrator
Newbie
*****
Posts: 5


View Profile
« on: February 19, 2011, 05:59:54 PM »

Recently I have tried to compile Apache-Ofbiz-10.04 using Ubuntu Linux. To do this you need a Java SDK and not JRE version. Well this took many attempts to install the JDK from Sun and not the OpenJRE from the standard Ubuntu repository. I did a lot of Googling about how to do this because I had a lot to learn. Like:
  • How to setup a new script to install
  • How to set the default Java version
  • How to use "update-java-alternatives" command
  • How to configure a new Java SDK for "update-java-alternatives" command to work
  • A list of all my mistakes

     I followed the post at http://codeslinger.posterous.com/how-to-install-java-7-on-ubuntu

     The site contains a shell script to register all the executable binaries. There is a button to download this script, but it did not work. I just copied and past the listing to an editor (gedit). Then saved it to my home documents directory.

     I opened a terminal and executed the shell command. This error shows up on the terminal - Syntax Error: word unexpected ( expected  "do"). But the "do" is there and everything looks correct. I remove all the blank lines in the script but I still get the error. After much time Googling and not finding an answer, I finally resort to my tried and true method of problem solving. Divide and Conquer.  I copy and paste the first few lines to a new file in gedit. Save as different name and execute. Ouch! It works. I copy more and try. It works. I copy all from original fill to new and it works. Mmm! I'm thinking, then the light comes on and I put all the peaces together.

     The answer is that when I copy and paste the first edit it came from an HTML page. Html uses the standard carriage return - line feed. This goes way back to the Teletype days. Linux uses the character - new line. The unexpected word in the above error was carriage return - line feed. So the copy and paste from one edit to another fixed my problem. Now I know how life is not easy and how you can be trick by what you can't see. But my divide and conquer saved me. (The scientific name for this is called "Binary Search").
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!