I'm trying to create a small little convenience script for our team. Unfortunately, our entire build environment is based on tcsh
for historical reasons. In the following script, each element of BUILD_MATRIX
is a :
delimited pair. I need to separate out each part of this pair for processing, but the array malfunctions for some reason.
#!/bin/tcsh
set BUILD_MATRIX = ( "makefile.make:make --jobs --makefile=makefile.make" \
"Makefile:make --jobs --makefile=Makefile" \
"build.xml:ant" )
foreach pair ( ${BUILD_MATRIX} )
echo "pair: ${pair}"
end
gives
pair: makefile.make:make
pair: --jobs
pair: --makefile=makefile.make
pair: Makefile:make
pair: --jobs
pair: --makefile=Makefile
pair: build.xml:ant
As you can see, the array is split on spaces -- completely reasonable, but not what is desired. How can I get pair=makefile.make:make --jobs --makefile=makefile.make
?
Using the linked duplicate, I was able to find a complete answer: