Files
HyperionOS/Src/Hyperion-bash/bin/id

20 lines
456 B
Plaintext

--:Minify:--
local args = {...}
local uid
if args[1] then
uid = syscall.getuid(args[1])
if not uid then
print("id: user '" .. args[1] .. "' does not exist")
syscall.exit(1); return
end
else
uid = syscall.getuid()
end
local pwent = syscall.getpasswd(uid)
local name = (pwent and pwent.username) or tostring(uid)
local gid = (pwent and pwent.gid) or uid
print(string.format("uid=%d(%s) gid=%d(%s)", uid, name, gid, name))