aboutsummaryrefslogtreecommitdiff
path: root/each
diff options
context:
space:
mode:
authorJohn Ankarstr\xf6m <john@ankarstrom.se>2021-06-03 09:28:28 +0200
committerJohn Ankarstr\xf6m <john@ankarstrom.se>2021-06-03 09:28:28 +0200
commit8b710c8969cf38b432fe81931fcce5ea8c8ba05c (patch)
tree1abc5fe0f7113d30ee5018502e7823381a268c26 /each
parent75f6926390f33f62b95b355d48bc5454243ddcea (diff)
downloadxutil-8b710c8969cf38b432fe81931fcce5ea8c8ba05c.tar.gz
each: Support |, &&, || separators
Diffstat (limited to 'each')
-rwxr-xr-xeach12
1 files changed, 6 insertions, 6 deletions
diff --git a/each b/each
index bed5bb8..b1e5727 100755
--- a/each
+++ b/each
@@ -2,17 +2,17 @@
$i = 0;
for (@ARGV) {
- if (/^;$/) {
- $i++;
- next;
- }
+ if (/^;$/) { $command .= '; '; next; }
+ if (/^&&$/) { $command .= '&& '; next; }
+ if (/^\|\|$/) { $command .= '|| '; next; }
+ if (/^\|$/) { $command .= '| '; next; }
s/"/"'"'"/g;
s/\$/\\\$/g;
s/\\\$\+/\$/g;
- $commands[$i] .= "\"$_\" "
+ $command .= "\"$_\" "
}
while (<STDIN>) {
chomp($ENV{x} = $_);
- system($_) for @commands;
+ system($command);
}