Results 1 to 2 of 2

Thread: script to read passwd file from input

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default script to read passwd file from input

    trying to get a script to prompt for username input, search the password file for a username and compare it to the /etc/passwd file to see if it legit or not. Any help here would be appreciated. All i got so far is:
    #!/bin/bash
    echo "Please enter a user name followed by [enter]";
    read fname
    grep -l ^$fname /etc/passwd
    if [ $fname -eq $f1 ]; then
    echo "grep $fname /etc/passwd";
    fi

    Thank you

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Posts
    367
    Thanks
    0
    Thanked 55 Times in 51 Posts
    Rep Power
    7

    Default

    use code tags on forum.

    what's $f1 in your script?

    search the password file for a username and compare it to the /etc/passwd file
    what do you mean?
    grep once, and that's it.
    «A problem clearly stated is a problem half solved.»

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. /dev/sdj: read failed after 0 of 4096 at 0: Input/output error
    By Naveen Joshi in forum CentOS / RHEL / Fedora
    Replies: 0
    Last Post: 24th February 2011, 08:51 PM
  2. Replies: 3
    Last Post: 1st November 2010, 03:43 PM
  3. Script to Read one line at a time from file
    By vishal_titre in forum Shell scripting
    Replies: 2
    Last Post: 8th September 2009, 08:50 AM
  4. Replies: 2
    Last Post: 28th June 2009, 09:10 PM
  5. Replies: 3
    Last Post: 31st March 2009, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41