aboutsummaryrefslogtreecommitdiff
path: root/each
diff options
context:
space:
mode:
Diffstat (limited to 'each')
-rwxr-xr-xeach18
1 files changed, 18 insertions, 0 deletions
diff --git a/each b/each
new file mode 100755
index 0000000..bed5bb8
--- /dev/null
+++ b/each
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+
+$i = 0;
+for (@ARGV) {
+ if (/^;$/) {
+ $i++;
+ next;
+ }
+ s/"/"'"'"/g;
+ s/\$/\\\$/g;
+ s/\\\$\+/\$/g;
+ $commands[$i] .= "\"$_\" "
+}
+
+while (<STDIN>) {
+ chomp($ENV{x} = $_);
+ system($_) for @commands;
+}