title: Properly splitting a string in UNIX shell
body: <p>I need to be able to split a string so that each string are passed as variable in my shell.</p>
  
  <p>I tried something like this:</p>
  
  <pre><code>$ cat test.sh
  #!/bin/sh
  
  COMPOPT="CC=clang CXX=clang++"
  $COMPOPT cmake ../gdcm
  </code></pre>
  
  <p>I also tried a bash specific solution, but with no luck so far:</p>
  
  <pre><code>$ cat test.sh
  #!/bin/bash -x
  
  COMPOPT="CC=clang CXX=clang++"
  ARRAY=($COMPOPT)
  "${ARRAY[0]}" "${ARRAY[1]}" cmake ../gdcm
  </code></pre>
  
  <p>I always get the non-informative error message:</p>
  
  <pre><code>./test.sh: 5: ./t.sh: CC=clang: not found
  </code></pre>
  
  <p>Of course if I try directly from the running shell this works:</p>
  
  <pre><code>$ CC=clang CXX=clang++ cmake ../gdcm
  </code></pre>