As per your expected output,
- Remove the not operator
!while calling the array in for loop. - we don't require "Processing file" in that
echocommand. - we don't need to pass the index value of array while looping it in
forloop.
Try as
declare -a files=( "A1S0" "D1S0" "D2S0" "D3S0" "D4S0" "D5S0" "D6S0" )
command_to_get_filesizes()
{
for i in "${files[@]}"; do
echo "$i"
done
}
command_to_get_filesizes