开发者

how to do getpwnam/getpwuid etc in tcl

开发者 https://www.devze.com 2023-01-17 17:57 出处:网络
does tcl have a standard way of doing NSS lookups (get开发者_开发技巧pwnam, setpwent,...)Tcl doesn\'t expose those as APIs (it doesn\'t really use them internally either) but the TclX extension packag

does tcl have a standard way of doing NSS lookups (get开发者_开发技巧pwnam, setpwent,...)


Tcl doesn't expose those as APIs (it doesn't really use them internally either) but the TclX extension package does support exactly what you want I believe. For example:

package require TclX

set uid [id convert user $tcl_platform(user)]
puts "Your userid is $uid and you are a member of these groups: [id groups]"

If you're using ActiveTcl, you've definitely got the TclX package available (either already installed or available from the teapot repository).

0

精彩评论

暂无评论...
验证码 换一张
取 消