以下是我希望我的代码所做的工作的总结:
if (group exists)
then
(add user to group)
else
(create group)
(add user to group)
fi我正在使用Ubuntu虚拟机,但我在类似站点上发现的所有结果都不起作用。
发布于 2020-08-08 13:14:06
$ groupadd --help
Usage: groupadd [options] GROUP
Options:
-f, --force exit successfully if the group already exists,
and cancel -g if the GID is already used所以你可以简单地做:
groupadd -f some_new_grphttps://stackoverflow.com/questions/29073210
复制相似问题