X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1012a6,29a923fbbd8ba89c X-Google-Attributes: gid1012a6,public X-Google-Thread: f996b,1bf4e46a52a72b7b X-Google-Attributes: gidf996b,public X-Google-ArrivalTime: 1994-12-17 17:20:08 PST Path: nntp.gmd.de!dearn!blekul11!idefix.CS.kuleuven.ac.be!ub4b!EU.net!howland.reston.ans.net! europa.eng.gtefsd.com!library.ucla.edu!psgrain!rainrgnews0!news.teleport.com!usenet From: merlyn@stonehenge.com (Randal L. Schwartz) Newsgroups: alt.ascii-art,comp.unix.shell Subject: Re: Anyway to randomize sig files? Date: 18 Dec 1994 00:15:28 GMT Organization: Stonehenge Consulting Services; Portland, Oregon, USA Lines: 59 Message-ID: References: <34550.stroheck@student.msu.edu> <3cppfl$mc9@cronkite.seas.gwu.edu> <3csckl$bru@lastactionhero.rs.itd.umich.edu> <3cv671$sn6@adam.cc.sunysb.edu> Reply-To: merlyn@stonehenge.com NNTP-Posting-Host: linda.teleport.com In-reply-to: bgriffin@ic.sunysb.edu's message of 17 Dec 1994 17:13:05 GMT Xref: nntp.gmd.de alt.ascii-art:18179 comp.unix.shell:17843 >>>>> "Eli" == Eli the bearded writes: Eli> Note cross posting. Eli> In article <3csckl$bru@lastactionhero.rs.itd.umich.edu>, Eli> knassen@cochrane.bus.umich.edu (Kent Stefl Nassen) writes: >>> *] > Can someone tell me if there is a way to randomize sig files? >> Here is a perl script I grabbed from somewhere. It was originally set >> up to put random one-line quotes in your .sig, but I modified it to >> just randomize a group of .sig files. Very simple. I use it with pine >> by aliasing pine to 'randsig; pine'. Then, whenever pine is run, you >> will get a random sig. You can use the same aliasing trick for other >> programs, assuming your shell allows aliases. Eli> #!/location/of/perl Eli> $home = "/your/home/directory"; Eli> srand(time|$$); Eli> @files = <$home/sigs/*>; Eli> $this = $files[rand(@files)]; Eli> `cp $this $home/.signature`; Eli> Anybody either have or can quickly modify this to Eli> be more friendly to the inode-imparied? My site has the Eli> absurd idea that I should only have 800 files. At this Eli> moment I am about 100 away from the limit. Lots of extra Eli> files will not help. Putting all the files in a cpio or Eli> ar archive would be great. Creating a new file format for Eli> this is fine as well. Well, put them all in the perl program then: #!/usr/bin/perl srand(time ^ $$); # not |, which loses information $/ = "\n%%\n"; @sigs = ; open(SIG, ">.signature"); print SIG $sigs[rand(@sigs)], "\n"; __END__ Here's a sig and it can have multiple lines %% Here's the second sig and it too can have multiple lines %% Here's another sig that has %% somewhere in it. %% And here's another sig. Really! There. It's just one file, with the data in the program. Perl is Your Friend. print "Just another Perl hacker," -- Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095 Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying Email: Snail: (Call) PGP-Key: (finger merlyn@ora.com) Phrase: "Welcome to Portland, Oregon ... home of the California Raisins!"