bash – Reading through an array

I’m trying to systematically remove profiles on some systems that were manually installed from github.

I’m going to do so with a policy from my MDM that runs a script, however, I can’t get the script to read into an array properly.

So far I have:

profilesToRemove=$(profiles list | grep com.github.erikberglund | /usr/bin/awk '{ print $4 }') for i in ${(f)profilesToRemove}; do
    profiles remove  "$i" done

The problem is I continue to get a bad substitution error with ${(f) and I don’t know how to proceed