Troy.A Johnson writes: > Bob, > > Does 'ls' explode at the command line? > > Here is a perl hack, but there has got to be a better > (perlish) way to do it, but my brain is stuck. > > ===== > #!/usr/bin/perl -w > $command = '| /usr/lib/sendmail linux-kernel at lists.real-time.com'; > opendir(D, '.'); > chomp(@dir = readdir(D)); > closedir(D); > foreach $file (@dir) > { > if ($file !~ m/^kernel[.]/) { next; } > local $/ = ''; > open(F, "< $file"); > @contents = <F>; > close(F); > open(C, $command); > print C $contents; > close(C); > sleep(5); > } > ===== > > Good luck, > > Troy > > >>> tanner at real-time.com 10/30/01 03:57PM >>> > Ok, I got 48,859 msg that I need to inject into the archives. > > I tried this little script: > > for i in `ls kernel.*`; do > cat $i | /usr/lib/sendmail linux-kernel at lists.real-time.com; > sleep 5s; > done > > The messages are called kernel.* (space is just for readability). > > I get this message: > > bash: /bin/ls: Argument list too long > > Anyone have a quick hack for me to get this working? Bob, A simple oversight :) ... but you should not even need the 'ls': for i in kernel.*; do cat $i | /usr/lib/sendmail linux-kernel at lists.real-time.com; sleep 5s; done Also, in the future if you ever run into the problem of Argument lists being too long for programs like 'ls' -- you can use 'xargs' (see manpage for more info) to feed long-argument-lists in a more digestable fashion. :) Regards, Matt -- For technical support contracts, visit https://order.mysql.com/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Mr. Matt Wagner <mwagner at mysql.com> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Herr Direktor /_/ /_/\_, /___/\___\_\___/ Hopkins, Minnesota USA <___/ www.mysql.com