If you're not going to check that they all have the same profile... why not just check the profile of the first, and then add them all in one command? (-c add-node -i $nodes) - it would be faster and any with the wrong profile will be skipped anyway.