Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell script which would Receive the log name during execution ,obtain information about it from /etc/passswd and display this information on screen

Posted By: Nathan Evans     Category: Unix / Linux / Ubuntu     Views: 5571

The file /etc/passwd contains information about all the users. However it is difficult to decipher the information stored in it. Write a shell script which would Receive the logname during execution ,obtain information about it from /etc/passswd and display this information on the screen in easily understable format.(Hint: Use Cut command)

Code for Shell script which would Receive the log name during execution ,obtain information about it from /etc/passswd and display this information on screen in Unix / Linux / Ubuntu

cat /etc/passwd|cut -f 1 -d ":"

Or 


echo "Enter user name : "
read lname
grep $lname /etc/passwd | cut -d":" -f 1-7 
  
Share: 



Nathan Evans
Nathan Evans author of Shell script which would Receive the log name during execution ,obtain information about it from /etc/passswd and display this information on screen is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!