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  &quot;$i&quot; done

The problem is I continue to get a bad substitution error with ${(f) and I don't know how to proceed
You're not iterating through an array. $profilesToRemove is not an array, it's just some lines of text.
${(f)profilesToRemove} is very strange. Perhaps you meant $profilesToRemove?
for needs to begin on a new line (or ; separated from the previous statement).