Category: | Win32 Stuff |
Author/Contact Info | Drake Wilson (premchai21; drake@libcom.com) |
Description: | A short script that simply takes a program and runs it with a few different sets of arguments. |
#!/usr/bin/perl my ($sep,$num,@prog,@each); die "Too few arguments -- for help, try $0 ?\n" if ((@ARGV < 3) && ((@ +ARGV < 1) || ($ARGV[0] !~ /\?|h/))); $num=shift @ARGV; print <<MUMBLE if ($num =~ /\?|h/); Usage: $0 # / p / a / where # is the number of arguments to take at a time, / is any string, used as a separator, p is the first part, usually the program name, of each command l +ine, and a is the list of arguments for p. For example: $0 1 / unzip / foo bar baz / will execute: unzip foo unzip bar unzip baz Or: $0 2 / someprog -osz / these are some args / will execute: someprog -osz these are someprog -osz some args MUMBLE die "\n" if ($num =~ /\?|h/); $sep=shift @ARGV; { my $tmp; push @prog, $tmp while (($tmp = shift @ARGV) && $tmp ne $sep); push @each, $tmp while (($tmp = shift @ARGV) && $tmp ne $sep); } while (@each) { my @here; foreach (1..$num) { push @here, shift @each; } system(@prog,@here); } |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: multi.pl
by merlyn (Sage) on Mar 06, 2001 at 21:59 UTC | |
by fundflow (Chaplain) on Mar 06, 2001 at 22:25 UTC | |
by merlyn (Sage) on Mar 06, 2001 at 22:28 UTC | |
by chipmunk (Parson) on Mar 06, 2001 at 23:13 UTC | |
by $code or die (Deacon) on Mar 18, 2001 at 23:36 UTC | |
by premchai21 (Curate) on Mar 10, 2001 at 00:42 UTC |
Back to
Code Catacombs