import posix
import string
uid = `posix.getuid()`
passwd = open('/etc/passwd')
for line in passwd.readlines():
rec = string.splitfields(line, ':')
if rec[2] == uid:
print 'hello', rec[0],
print 'mind if we call you bruce?'
break
else:
print "I can't find you in /etc/passwd"
:)
sharma_vivek82
0
Newbie Poster
Recommended Answers
Jump to PostIndent it correctly, download posix and give it a try.
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.