Nested functions in for loop seems to be not working as expected. The loop breaks after iterating once
# copy files
copyFiles () {
for (( i=0; i<${#filetype[@]}; ++i )); do
//some code goes here
done
}
# copy common components
copyComponents () {
copyFiles $1
}
for (( i=0; i<3; ++i )); do
echo $i //iterates only once.. expectation is thrice
case $1 in
components)
copyComponents $module;;
*)
echo "unknown type"
esac
done
I am not sure what I am doing wrong but for loop exits after iterating once.