#!/usr/bin/perl $i = 0; for (@ARGV) { if (/^;$/) { $i++; next; } s/"/"'"'"/g; s/\$/\\\$/g; s/\\\$\+/\$/g; $commands[$i] .= "\"$_\" " } while () { chomp($ENV{x} = $_); system($_) for @commands; }