Hi Forum
Im making a script that takes multiple unix users and lists the users and the groups that the user is part of. the grouplist looks like this
I got most of it working but Im having trouble with a while loop that im using to filter out groups that dont matter.
I am trying to get only the groups that are in the grouplist to be in the variable FilterIDgroups. Sorry the variable names are bad, I had to change them to post them online.
Im making a script that takes multiple unix users and lists the users and the groups that the user is part of. the grouplist looks like this
Code:
grouplst="example_group1|example_group2|example_group3|example_group4"
Code:
cntr3=1
tempgrplst=$grouplist
FilterIDgroups=""
while (($cntr <= $groupcnt))
do
currentgroup=$(print $tempgrplst|awk -F '|' '{print $1}')
cntr=$(($cntr + 1))
print $IDgroups | grep $currentgroup >> $FilterIDgroups
tempgrplst=${tempgrplst#*\|}
done