Within the example below a WDL array of strings, test
is defined as "a","b","c","d"
the value total
is a variable that signifies the length of the WDL array. Using the bash for loop, which will iterate from 1 up to length of the array, I seek to print out the values at each indicy in the array and output it to another array. For example when the loop is on 1 the value at indicy 1 within the array will be printed out in this case "a"
and stored in the array out, if the loop is on 2 then the value "b"
will be printed out and stored in the array out, etc. I tried the below example, however, I get an error when running. Can anyone help me with this problem?
How I tried to do this in WDL:
task A {
input {
Array[String] test = ["a","b","c","d"]
Int total = length(test)
}
command {
for (( c = 1; c <= ${total}; c++ ))
do
echo ${test[$c]}
done
}
output {
Array[String] out = read_lines(stdout())
}
}