#!/usr/bin/perl -w # # race # # Test race conditions by running several instances of a command at # once. # # Usage: race [-num] command args... # # Bugs: the usual quoting and shell metacharacter problems, doesn't # wait for completion before exiting # # -- Ed Avis, epa98@doc.ic.ac.uk # use strict; my $DEFAULT_NUM = 1000; # Default number of ps to run my $num = $DEFAULT_NUM; if ($ARGV[0] =~ /^-(\d+)$/) { shift; $num = $1; } if (not @ARGV) { die "usage: $0 [-num] command args..."; } my $cmd = join(' ', @ARGV) . ' & '; system($cmd x $num);