HTH,use Expect; $exp = new Expect; $exp->log_stdout(0); $exp->log_file(\&formatoutput); $exp->spawn("/bin/sh"); $exp->send("/bin/cat /etc/passwd\n"); $exp->soft_close(); sub formatoutput { my $input = shift; # format however you'd like # e.g. $input =~ s/\$//g; # That will get rid of the $ output and leave you with # only data. You will also need to get rid of the # commands as they too will be passed to this function. # By that I mean /bin/cat /etc/passwd # You can do all types of good stuff for additional # formatting such as formline or format STDOUT_TOP = print STDOUT "\n\n$input\n\n"; # or if you used formline print STDOUT "$^A", etc. # but I'll leave the particulars to you. return; }
In reply to Re: Expect, STDout, and formating
by cbro
in thread Expect, STDout, and formating
by jcpunk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |