Method: Mac::Group#gid_next

Defined in:
lib/beaker/host/mac/group.rb

#gid_nextFixnum

Gives the next gid not used on the system

Returns:

  • (Fixnum)

    The next gid not used on the system



93
94
95
96
# File 'lib/beaker/host/mac/group.rb', line 93

def gid_next
  gid_last = execute("dscl . -list /Groups PrimaryGroupID | sort -k 2 -g | tail -1 | awk '{print $2}'")
  gid_last.to_i + 1
end