I'm working on a pipeline for RNA-Seq and I'm having trouble with my code.
One of my input parameters is the experimental design:EXP_DESIGN=3,3,3
. I want to split this string into an array, which for I am using ARRAY_EXP=$( echo $EXP_DESIGN | tr ',' '\n' )
. This command line works fine for me. However, if I try to count the elements of this array with NUM_COND=${#ARRAY_EXP[@]}
, it does not work.
In my log.txt file, I obtain this information:
exp_design 3,3,3
array_exp 3 3 3
num_cond 1
I would appreciate any help
EDIT: I have also tried
IFS=',' read -ra ARRAY_EXP <<< "$EXP_DESIGN"
And I get a different error:
exp_design 3,3,3
array_exp 3
num_cond 3