Annotation of researchv9/cmd/passwd.sh, revision 1.1.1.1

1.1       root        1: #!/bin/sh -p
                      2: PATH=/bin:/usr/bin
                      3: export PATH
                      4: #      invoke normal passwd command with argument
                      5: #
                      6:        /bin/passwdx $*
                      7: #      test if successful and if we should continue
                      8: case $? in
                      9: 0) ;;
                     10: *) exit 1 ;;
                     11: esac
                     12: #      test if user updating entry in /etc/passwd
                     13: case $1 in
                     14: -n)
                     15:        case $# in
                     16:        1)      linex1=`tail -1 /etc/passwd` ;;
                     17:        2)      linex1=`grep ^$2: /etc/passwd` ;;
                     18:        esac
                     19:        userx1=`echo $linex1 | awk -F: '{print $1}'`
                     20:        #
                     21:        #       update user list on machine
                     22:        #
                     23:        echo -n "full name: "
                     24:        read namex1
                     25:        echo -n "dept no: "
                     26:        read deptx1
                     27:        echo -n "sponsor: "
                     28:        read sponsx1
                     29:        egrep -v "^$userx1[     ]" /usr/adm/usrlist > /tmp/p$$
                     30:        echo "$userx1   $deptx1 $namex1 $sponsx1" >>/tmp/p$$
                     31:        sort -o /usr/adm/usrlist /tmp/p$$
                     32:        rm /tmp/p$$
                     33:        ;;
                     34: -a)
                     35:        case $# in
                     36:        1)      userx1=`id | sed 's/.*(\(.*\)) g.*/\1/'`
                     37:                linex1=`grep ^$userx1: /etc/passwd` ;;
                     38:        2)      linex1=`grep ^$2: /etc/passwd` ;;
                     39:        esac
                     40:        ;;
                     41: *) exit 0 ;;
                     42: esac
                     43: echo -n "mail address: "
                     44: read mailx1
                     45: #
                     46: #      update mailing forwardlist for user
                     47: #
                     48: mail postmaster <<EOF
                     49: account = $linex1 
                     50: name = $namex1
                     51: address = $mailx1
                     52: dept = $deptx1
                     53: sponsor = $sponsx1
                     54: EOF
                     55: #

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.