diff options
author | John Ankarstr\xf6m <john@ankarstrom.se> | 2021-06-02 21:12:38 +0200 |
---|---|---|
committer | John Ankarstr\xf6m <john@ankarstrom.se> | 2021-06-02 21:12:38 +0200 |
commit | 75f6926390f33f62b95b355d48bc5454243ddcea (patch) | |
tree | 43188f35ea35b96ba11efc3566da012480c7c945 /each | |
parent | 6f014212fb084876ec0e0f63b07a304437038fed (diff) | |
download | xutil-75f6926390f33f62b95b355d48bc5454243ddcea.tar.gz |
Add 'each' utility
Diffstat (limited to 'each')
-rwxr-xr-x | each | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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; +} |