If the input variable is an array, we must include an array separator. In WDL 1.0, this is done using the sep=
expression placeholder. Every value in the WDL Array[String] will be separated by whatever value is declared via sep
. In this example, that is a simple space, as that is one way how to construct a bash variable.
task count_words {
input {
Array[String] a_big_sentence
}
command <<<
ARRAY_OF_WORDS=(~{sep=" " a_big_sentence})
echo ${#ARRAY_OF_FILES[@]} >> length.txt