I have the following bashscript below. My goal is to itterate over multiple files in the directory. The name of the files will be batch_1, batch_2, batch_3, batch_4, etc. There should be no more than 7 batches.
I have the following script below.
files=( $(echo 1) )
declare -p files
declare -a files=([0]="batch_")
for data in ${files[@]}
do
cat ${data} | cut -d , -f2,3 | grep -v "IP" > data_ip_${data}
done
However, when I run this I receive the error zsh: bad subscript for direct array assignment: 0
Does any know what can cause this specifically with my script? Or possible solutions? Any advice may help.