Hi I would like to write a script which accepts the user name from the command line and it should find the user id of that particular user name.
Could any one of you pls give me the command which will be useful.
Thanks in Advance
Raju
Hi I would like to write a script which accepts the user name from the command line and it should find the user id of that particular user name.
Could any one of you pls give me the command which will be useful.
Thanks in Advance
Raju
Type the command as follows
$id [username]
uid=1008(my_user) gid=1001(mygroup)
This is what works for me on a Solaris. The username option if not supplied will display the id of the user currently logged in.
Regards,
Rahul.
use the /etc/passwd file
awk -F":" ' /<username> / { print $3}' /etc/passwd
Thanks you guys.
Madhan,
Your code is working fine.
Rahul,
Its not working, even I haven't understood the code properly. Could you please explain it.
Thanks in Advance.
Raju