home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / perl / 7593 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  1.5 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!saimiri.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!ogicse!reed!romulus!merlyn
  2. From: merlyn@ora.com (Randal L. Schwartz)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Help -- why doesn't it work?
  5. Message-ID: <MERLYN.92Dec23081925@romulus.reed.edu>
  6. Date: 23 Dec 92 16:19:28 GMT
  7. Article-I.D.: romulus.MERLYN.92Dec23081925
  8. References: <1992Dec8.141905.35130@Lehigh.EDU> <ljfcamINNvn@exodus.Eng.Sun.COM>
  9. Sender: news@reed.edu (USENET News System)
  10. Organization: Stonehenge Consulting Services; Portland, Oregon, USA
  11. Lines: 22
  12. In-Reply-To: patl@bodacia.Eng.Sun.COM's message of 23 Dec 92 00:22:46 GMT
  13.  
  14. In article <ljfcamINNvn@exodus.Eng.Sun.COM> patl@bodacia.Eng.Sun.COM (Pat Lashley) writes:
  15.    If you have xargs, it is usually better to use:
  16.  
  17.        system ("find . -user $olduid -print | xargs chown $newuid");
  18.  
  19. If you have Perl, why even use xargs?
  20.  
  21.     $newuid = getpwnam($newuid) unless $newuid =~ /^\d+$/; # force number
  22.     open(F,"find . -user $olduid -print|");
  23.     while(<F>) {
  24.         chop;
  25.         chown($newuid,(stat($_)[5]),$_);
  26.     }
  27.  
  28. There.  Two processes.  If you wanna even be weirder, use "find2perl"
  29. to do the whole thing in Perl.
  30.  
  31. sub r{print pack("c*",reverse (unpack("c*",$_[0])),32);}&r("tsuJ");&r("rehtona");&r("lreP");print"hacker,"
  32. --
  33. Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
  34. merlyn@ora.com (semi-permanent) merlyn@reed.edu (for newsreading only)
  35. factoid: "Portland, Oregon, home of the California Raisins and Lone-Star Beer!"
  36.