#! /usr/bin/perl
%names = ( );

# $x = qr/([\w-]+) \s* (.*)/x; # cmd sep
# $x = qr/([^<>&]*)(.*) /x; # arg sep
$x = qr/ (<|>>|>) \s* ( (?<=<|>) &[012] | [^<>&\s]*) /x; # redir

print "RE = $x\n";
while(1) {
	print ">";
	$in = <STDIN>;
	chomp($in);
	last if $in eq 'quit';
	if(@f = $in =~ /$x/x) {
		for(1..@f) {
			if(exists $names{$_}) { print " $names{$_}n"; }
			else { print " $_"; }
			print ":$$_|\n";
		}
	} else {
		print "Failed\n";
	}

}
