From: Paul Lutus Date: 2006-11-25T17:05:05+09:00 Subject: Re: syntax error Une b辿vue wrote: > > something strange, if i run my script like that : > > $ /opt/local/bin/ruby myscript.rb > > no prob > > the shebang in my script is : > > #!/usr/bin/env ruby -w > > which ruby give me the above ruby (under /opt) > > then, running this script as : > > $ ./myscript.rb i get an error on line 8 : > ./wav2xml.rb: line 8: syntax error near unexpected token `(' > ./wav2xml.rb: line 8: ` fxml=file.gsub(/(.*)\.wav/,'\1.xml')' > > the major difference is upon the "-w" option within the shebang however, > if i delete this option i do have the same error. Show us the code that caused the error. It is obviously a real error, but it is difficult to sort out what it is from the message. > sometimes an error given at one line comes from the preceeding one : > file=RGV[0] # line 7 > > for me the syntax is correct ??? What is in RGV[0]? What is the content of the offending line? Maybe you should change the shebang line you are using, or delete one of the ruby references on your system (you appear to have more than one). Using the "/usr/bin/env ruby" shebang line makes an assumption about your system, that you will always hit the intended Ruby version first. If you have more than one version installed, you may not hit the intended one, depending on the order of your search path. But this is speculation without seeing the error line and its context. -- Paul Lutus http://www.arachnoid.com