Sample Header Ad - 728x90

zsh: bad subscript for direct array assignment: 0

0 votes
1 answer
1359 views
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=(="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.
Asked by Lam (1 rep)
Jan 26, 2022, 04:12 AM
Last activity: Jan 26, 2022, 04:53 AM