Hi. I'm trying to write my own script that will back up user directories. I wanted this script to backup all user directories based on the user group. So far, I have a simple script that'll backup whatever directory/directories I want. What I can't seem to get right is extracting the line containing users from /etc/group, ie:
root@epitaph portage # cat /etc/group | grep users
I know what I need, I just don't how to parse it. I need the users (user1,user2,user3) to be extracted and commas replaced with spaces so that I can use that output as a space delimited variable for a bash for loop, ie:
userlist="user1 user2 user3"
for user in $userlist