title: Shell script and java parameter
body: <p>I have written the script <strong>run.sh</strong> below for calling a java class :</p>
  
  <pre><code>java -cp . Main $1 $2 $3 $4
  </code></pre>
  
  <p>Here is my java class (it just displays the args) :</p>
  
  <pre><code>public class Main {
      public static void main(String[] args) {
          for (String arg : args) {
              System.out.println(arg);
          }
      }
  }
  </code></pre>
  
  <p>This is working unless I try to pass a parameter containing a space. For example :</p>
  
  <pre><code>./run.sh This is "a test"
  </code></pre>
  
  <p>will display :</p>
  
  <pre><code>This
  is
  a
  test
  </code></pre>
  
  <p>How could I modify my shell script and/or change my parameter syntax to pass the parameter "a test" unmodified ?</p>