mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2024-06-15 13:16:37 +00:00
12 lines
330 B
Python
12 lines
330 B
Python
|
# Return a list of users on this system
|
||
|
|
||
|
def get_users():
|
||
|
# thanks, ~dan!
|
||
|
users = []
|
||
|
with open("/etc/passwd", "r") as f:
|
||
|
for line in f:
|
||
|
if "/bin/bash" in line:
|
||
|
u = line.split(":")[0] # Grab all text before first ':'
|
||
|
users.append(u)
|
||
|
|
||
|
return users
|