I have this code:
if (( i == 0 )); then
findCommand="find . -name \"${id}*0${month}*\" | sort -r | head -1"
else
findCommand="find . -name \"${id}*0${month}*\""
fi
while read fileName; do
data[i]=$(sed -n -f sed_script "${fileName}")
trim=${fileName#./* }
period[i]=${trim%.json}
done < <(${findCommand})
My problem with it is that the process substitution is returning nothing, I suposse It has to do with the wildcard expansion but I have no idea how to properly escape the findCommand string so that the wildcard expansion is properly done.