I am new to bash script and writing the bash script. I have declared an array and i have given the values. But When i pass the array in the loop values are not getting inside the loop. Below is my code
declare -a files=( "A1S0" "D1S0" "D2S0" "D3S0" "D4S0" "D5S0" "D6S0" )
command_to_get_filesizes() {
for i in ${#files[@]}; do
echo test
echo "${files[@]}"
echo files[$i]
echo $(date +%m)
aws s3api list-objects --bucket ui-dl-weather-ecmwf-ltf --prefix daily/ --query "Contents[?contains(Key, 'files[$i]$(date +%m%d)')]" --output text | awk '{print $2, $4}' >> "$FILESIZE"
}
command_to_get_filesizes()
Can u pls help me on this.. 'files[$i]$(date +%m%d)' array values should come in this place
eg: 'A1S0[$i]$(date +%m%d)'