Hi guys,
I am using dscl . read to create an array with users in the Admin Group. However, its not giving me what I want.
I want each user in the Admin Group to be a separate element in the array. How do I do that? I tried using cut -d " " but that didn't work
#Users Array - All users in Admin group
USERS=$( dscl . -read Groups/admin GroupMembership | cut -c 18- )
Output: USERS=([0]="root admin1 admin2")
Desired Output: USERS=([0]="root" [1]="admin1" [2]="admin2")