Hi,

i have to write/as homework/ a script that shows list of all users ,users belong to group (which is main group for every user has been showed) defined as parameter of script. In the case of -c, show count of those users. TIP: /etc/passwd, /etc/group

Recommended Answers

All 4 Replies

hi,

good for you ! it's in deed a good exercise.

what have tried so far ?

hi,

want to use it with /etc/group but "permission denied" ..its a school linux server ...do u think u should use command getent? i am really newbie in this..

if [ "$2" = "-c" ]; then
   for i in $( grep -i "$1" $SUBOR); do
     let "pocet+=1"
   done
   echo $pocet

else
   for i in $( grep -i "$1" $SUBOR | cut -d ":" -f 1 $SUBOR); do
      echo $i
   done
fi

but still permission denied..i cannot check the result...

everybody should be able to read /etc/group :(
what version of linux is this?
what does print ls -l /etc/{passwd,group}?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.