title: Groovy: What's wrong with this "Hello World" program?
body: <p>This does not work:</p>
  
  <pre><code>$ groovy -e 'println "Hello, world!"'
  org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  script_from_command_line: 1: unexpected char: 0xFFFF @ line 1, column 23.
     println "Hello, world!
                           ^
  
  1 error
  </code></pre>
  
  <p>However, putting a space between the last double- and single-quote works...</p>
  
  <pre><code>$ # groovy -e 'println "Hello, world!"'
  $   groovy -e 'println "Hello, world!" '
  Hello, world!
  </code></pre>
  
  <p>... even though <code>bash</code> seems to be able to correctly handle the trailing <code>"'</code> pair (i.e., without any intervening space) as follows:</p>
  
  <pre><code>$ echo '"Hello, world!"'
  "Hello, world!"
  </code></pre>
  
  <p>Also, parenthesizing the <code>println</code> argument works just fine:</p>
  
  <pre><code>$ groovy -e 'println ("Hello, world!")'
  Hello, world!
  </code></pre>
  
  <p>Now, I would like to know why the very first case does not work.</p>
  
  <p>I'm using:</p>
  
  <ul>
  <li>bash, version "4.2.45(1)-release (x86_64-pc-linux-gnu)"</li>
  <li>groovy, version 2.1.3</li>
  </ul>