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