- TS TS
- #141
answering part A
groupadd [OPTIONS] GROUPNAME For example to create a group named mygroup with GID of 1010 you would type: groupadd -g 1010 mygroup getent group | grep mygroup mygroup:x:1010: If a group with the given GID already exist, you will get the following error: groupadd: GID '1010' already exists #!/bin/bash cat /etc/group | cut -f1 -d":" | sort -n | uniq -c | while read x ; do [ -z "${x}" ] && break set - $x if [ $1 -gt 1 ]; then gids=
groupadd [OPTIONS] GROUPNAME For example to create a group named mygroup with GID of 1010 you would type: groupadd -g 1010 mygroup getent group | grep mygroup mygroup:x:1010: If a group with the given GID already exist, you will get the following error: groupadd: GID '1010' already exists #!/bin/bash cat /etc/group | cut -f1 -d":" | sort -n | uniq -c | while read x ; do [ -z "${x}" ] && break set - $x if [ $1 -gt 1 ]; then gids=
gawk -F: '($1 == n) { print $3 }' n=$2 /etc/group | xargs
echo "Duplicate Group Name ($2): ${gids}" fi done or to check group exisits or not . read -p "enter group name: " group if grep -q $group /etc/group then echo "group exists" else echo "group does not exist" groupadd [OPTIONS] GROUPNAME --admin f