home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / wizards / 3343 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.9 KB  |  63 lines

  1. Newsgroups: comp.unix.wizards
  2. Path: sparky!uunet!darwin.sura.net!mips!sdd.hp.com!usc!sol.ctr.columbia.edu!eff!news.oc.com!convex!tchrist
  3. From: Tom Christiansen <tchrist@convex.COM>
  4. Subject: Re: Making ``.plan'' EXECUTE a Program ???
  5. Message-ID: <1992Jul29.145537.3223@news.eng.convex.com>
  6. Originator: tchrist@pixel.convex.com
  7. Sender: usenet@news.eng.convex.com (news access account)
  8. Nntp-Posting-Host: pixel.convex.com
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. Organization: CONVEX Realtime Development, Colorado Springs, CO
  11. References: <31567@adm.brl.mil> <#q61Hejis8@atlantis.psu.edu>
  12. Date: Wed, 29 Jul 1992 14:55:37 GMT
  13. X-Disclaimer: This message was written by a user at CONVEX Computer
  14.               Corp. The opinions expressed are those of the user and
  15.               not necessarily those of CONVEX.
  16. Lines: 45
  17.  
  18. David Barr writes:
  19.  
  20. :awk is your friend.
  21.  
  22. Well this may be, but the csh most decidely is not.
  23.  
  24. :foreach user (`/usr/bin/ypcat passwd | /usr/bin/egrep -v '^\+|ftp|demo' | awk -F: '{ print $1 }'`)
  25.  
  26. On my system, I get:
  27.  
  28. Too many words from ``.
  29.  
  30. :no temp files, and it's got to be a heck of a lot faster than using ex
  31. :and files.  
  32.  
  33. If only it ran; it does take several processes too many, too.
  34.  
  35. :set userlist=`/usr/bin/egrep -v '^\+|uucp|news|sync|' | awk ....`
  36. :set userlist="$userlist `/usr/bin/ypcat passwd | egrep ....`"
  37. :foreach user ($userlist)
  38.  
  39. How about instead of Perry Hutchison's csh script, simply:
  40.  
  41.  
  42.     #!/usr/bin/perl
  43.     chop($host = `hostname`);
  44.     for ('uucp', 'news', 'sync') { $skip{$_}++ }
  45.     while (@pwent = getpwent()) {
  46.     ($user, $home) = @pwent[0,7];
  47.     next if $skip{$user};
  48.     $rcfile = "$home/.boot.$host";
  49.     next if $done{$rcfile};
  50.     if (-f $rcfile) { 
  51.         system "su -f $user < $rcfile &"; 
  52.         $done{$rcfile}++;
  53.     } 
  54.     } 
  55.  
  56. --tom
  57.  
  58. -- 
  59.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  60.  
  61.  
  62.     "We don't care.  We don't have to.  We're the Phone Company."
  63.