Skip to content

Instantly share code, notes, and snippets.

@rockpapergoat
Created March 5, 2011 17:52
Show Gist options
  • Save rockpapergoat/856545 to your computer and use it in GitHub Desktop.
Save rockpapergoat/856545 to your computer and use it in GitHub Desktop.
capture users and uids, filtering for > 500 uids
#!/usr/bin/env ruby -wKU
# capture users and uids, filtering for > 500 uids
# want to emulate dscl . -list /users UniqueID | awk '$2 > 500 { print $1 }'
def get_nonsys_users
users = `dscl . -list /users UniqueID`.split("\n").collect! {|u| u.sub!(/\ +/, ",").split(",").to_a}.select {|u| u[1].to_i > 500}
end
p get_nonsys_users
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment