I am trying to use multiple for loops to iterate over files with folders within a single folder Eg: Main -> multiple Folders -> Multiple files within folder I am trying to iterate over those files I have written bash script to do so, But I cannot parse variable in the find function, I was wondering is there an easy way to do so,
ApisExternal=$(find main -maxdepth 1 -type d)
for $spaces in $ApisExternal
do
$ApiSpaces= $(find $spaces -maxdepth 1 -type f)
for ApiFixValidationError in $ApiSpaces
do
echo $ApiFixValidationError
done
done
This throws an error: `$spaces': not a valid identifier
How can I use the variable as a path for the nested for loop find function. I would appreciate any help with this.