home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / usr / template / client / etc / nulib / nu1.sh next >
Linux/UNIX/POSIX Shell Script  |  1992-04-10  |  1KB  |  40 lines

  1. #! /bin/csh -fb
  2. # This shell script is called from /etc/nu to create a new directory for a
  3. # new user, and to make the necessary links and permissions for it.
  4. # it is named "nu1.sh" instead of something like "makeuser.sh" to discourage
  5. # people from trying to run it standalone, without going through nu.
  6.  
  7. set uid=$1
  8. set gid=$2
  9. set logindir=$3
  10. set linkdir=$4
  11. set clobber=$5
  12. set debug=$6
  13. set username=$7
  14. set langauge=$8
  15. set noglob; set path=(/etc /usr/etc $path); unset noglob
  16. if ( $debug != 0 ) then
  17.     set verbose
  18. endif
  19. if ($clobber) then
  20.     rm -rf $logindir
  21.     mkdir $logindir
  22. endif
  23. if ("$logindir" != "$linkdir") then
  24.     ln -s $logindir $linkdir
  25.     chown $uid $linkdir
  26.     chgrp $gid $linkdir
  27. endif
  28. if (($debug == 0) && $clobber) chown $uid $logindir
  29. if (($debug == 0) && $clobber) chgrp $gid $logindir
  30.  
  31. # Mail to root that a new user was created....
  32. if ($debug == 0) then
  33.     mail -s "Welcome new user $username:t" root  << xxMAILxx
  34.     The new user "$username:t" was added by $user.
  35.  
  36.     The Nu Program.
  37. xxMAILxx
  38. endif
  39.