Shell脚本:如何检查多个组是否存在并在回显中显示

Shell Script: how to check multiple groups if they exists and display in echo

这是我当前的代码:

 if [ $(getent group administrators) ]; then
   echo "Group exists"
 else
   echo "Group does not exist"
 fi

我的问题是:

使用&&测试多个条件。

if [ $(getent group administrators) ] && [ $(getent group students) ]
then
    echo The groups administrators and students exit
else
    echo The groups administrators and students do not both exist
fi