|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 1020 (0x3fc) Types: TextFile Notes: UNIX file Names: »newusr«
└─⟦eafc30061⟧ Bits:30001199 Commodore 900 hard disk image └─⟦8281d0872⟧ UNIX Filesystem └─ ⟦294235107⟧ »vol3.fd« UNIX Filesystem └─ ⟦this⟧ »etc/newusr« └─⟦eafc30061⟧ Bits:30001199 Commodore 900 hard disk image └─⟦5ec4c54f2⟧ UNIX Filesystem └─ ⟦this⟧ »etc/newusr« └─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦926b8033d⟧ UNIX Filesystem └─ ⟦this⟧ »etc/newusr«
: /etc/newusr 5/31/83 : Usage: /etc/newusr user ... PFILE='/etc/passwd' LOCK='/tmp/passwd' USRDIR='/u' GID='1' : test nonempty arg list case $# in 0) echo "Usage: /etc/newusr user ..." >&2 && exit;; esac : test nonexistance of LOCK and whether invoker is root if test -f $LOCK then echo "newusr: lock $LOCK file exists" >&2 && exit fi >$LOCK chown root $LOCK 2>/dev/null || echo "newusr: permission denied" >&2 && rm $LOCK && exit : sort $PFILE by uid and find max uid sort -n '-t:' +2 -3 -o $PFILE $PFILE UID=`tail -1 $PFILE | sed -n "s/[^:]*:[^:]*:\\([^:]*\\).*/\\1/p"` : loop for each user while test $# -ne 0 do : test if user exists already if grep "^$1:" $PFILE >/dev/null then echo "newusr: user $1 already exists" >&2 else UID=`expr $UID + 1` : update password file echo "$1::$UID:$GID::$USRDIR/$1:" >>$PFILE : make new directory and .profile mkdir $USRDIR/$1 echo "export PATH=:$USRDIR/$1/bin"'$PATH' >>$USRDIR/$1/.profile chown $1 $USRDIR/$1 $USRDIR/$1/.profile fi shift done rm $LOCK