Import
This commit is contained in:
19
Src/Hyperion-bash/bin/id
Normal file
19
Src/Hyperion-bash/bin/id
Normal file
@@ -0,0 +1,19 @@
|
||||
--:Minify:--
|
||||
local args = {...}
|
||||
local uid
|
||||
|
||||
if args[1] then
|
||||
uid = syscall.auth_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.auth_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))
|
||||
Reference in New Issue
Block a user