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

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}?