Skip to content

Instantly share code, notes, and snippets.

@tom-butler
Created April 1, 2020 02:49
Show Gist options
  • Save tom-butler/6ff5f6749aab570fce52bf80479c2ba6 to your computer and use it in GitHub Desktop.
Save tom-butler/6ff5f6749aab570fce52bf80479c2ba6 to your computer and use it in GitHub Desktop.
Finds missing gid and creates a new group for it
#!/bin/bash
# get error messages from groups
g=$(groups 2>&1 > /dev/null)
if [ -z "${g}" ]; then
# pull gid from error message
gid=${g/groups: cannot find name for group ID/}
# create a group with the missing gid
groupadd --gid "$gid" efs
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment