I am trying to list all the system users, I know that on Linux I could use
awk -F: '{ print $1 }' /etc/passwd
and on Windows I could use wmic useraccount get name
but I was wondering if there was function in V that would be better suited for it and didn't require different commands for Linux and Windows.
How to get a list of system users in vlang?
203 views Asked by a coder At
1
EDIT: You can now use
fn user_names() ?[]string
from theos
module in order to get the names of users on the system.There currently is now way to get a list of users on the system. However you can you compile time if statements to execute the commands you referred to above.