Problem in Getting members of a group using "grep" command
Posted on 2004-08-15
I wanted to see the members of a particular group and a person suggested me to do
"grep neighbor /etc/group" where neighbor is the group name.But when I did that it showed "neighbor:*:205:"
So it didn't show any names?
He also said I can do in a script as follows...
# Pass group name as an argument.
echo -n "Members of $1: "
grep $1 /etc/group| cut -d: -f4
When I executed the above script from my home directory using "bash scriptname" it asked for "Members of :" and when I entered group name as neighbor, nothing happened ?
So any ideas why that problem is occuring please?