Tuesday, 4 September 2012

Shell Script to Get the details of user

#!/bin/bash
#Get the details of user

echo "Enter the user name"
read n
echo "username is :`cat /etc/passwd | grep $n | cut -d : -f 1`"
echo "password is :`cat /etc/passwd | grep $n | cut -d : -f 2`"
echo "user-id is :`cat /etc/passwd | grep $n | cut -d : -f 3`"
echo "group-id is :`cat /etc/passwd | grep $n | cut -d : -f 4`"
echo "fullname is :`cat /etc/passwd | grep $n | cut -d : -f 5`"
echo "default directory is :`cat /etc/passwd | grep $n | cut -d : -f 6`"
echo "default shell is :`cat /etc/passwd | grep $n | cut -d : -f 7`"

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
@Gnosioware Solutions