Looking for someone good in Linux Shell Scripting...

Discussion in 'Services' started by hippo_dance, Jan 1, 2012.

  1. #1
    Modify the adduser scripts to do the following.

    a. Use gawk to extract all the user identification numbers (UIDs) out of the mypasswd file into a file called currentuid.
    b. Use sed to remove all the system UID numbers, meaning all the one- , two-, and three-digit UIDs. You might want to put the remaining UIDs in a file named currentuid2.
    c. Use sed to remove the nobody (60001), noaccess (60002), and nobody4 (65534) UIDs. You might want to put the remaining UIDs in a file named currentuid3.


    Hint:
    a) 3rd Colum UID at /etc/passwd

    mypasswd
    ---------

    root:x:0:1:Super-User:/:/sbin/sh
    daemon:x:1:1::/:
    bin:x:2:2::/usr/bin:
    sys:x:3:3::/:
    adm:x:4:4:Admin:/var/adm:
    lp:x:71:8:Line Printer Admin:/usr/spool/lp:
    uucp:x:5:5:uucp Admin:/usr/lib/uucp:
    nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
    listen:x:37:4:Network Admin:/usr/net/nls:
    nobody:x:60001:60001:Nobody:/:
    noaccess:x:60002:60002:No Access User:/:
    nobody4:x:65534:65534:SunOS 4.x Nobody:/:
    user1:x:1001:10::/export/home/user1:/bin/sh
    user2:x:1002:10::/export/home/user2:/bin/ksh

    adduser.sh
    ----------

    #!/bin/sh

    # Purpose: To write a script to add user to the system.
    # Name: adduser


    ### Set a shell variable to test the grep command.
    name=nuucp # Should match a single entry
    #name=uucp # Should match a single entry
    #name=root # Should match a single entry
    #name=rot # Should not match any entry

    grep "^$name:" ./mypasswd

    # End of lab 4
     
    hippo_dance, Jan 1, 2012 IP
  2. hippo_dance

    hippo_dance Active Member

    Messages:
    1,007
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    73
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    help needed urgently.
     
    hippo_dance, Jan 1, 2012 IP