usermod -a -G command will add the given user to a supplementary group. The change will be reflected for the user the next time that user logs in.
The user will see the new group in the output of the
groups command, and in
id -nG. Any other user may use
id -nG dog.
The username of the user will additionally be listed in the group's entry in
/etc/group and/or in the output of
getent group (also
getent group white_house_group to only see that one group).
As a programmatic example:
usermod -a -G white_house_group dog
if id -nG dog | ! grep -q white_house_group; then
echo 'user not added to group!' >&2
... but one may argue that
usermod should exit with a failure if the modification was unsuccessful:
if ! usermod -a -G ...; then
echo error >&2
However, I don't have a Linux system to test this on.