From: Austin S. <te...@of...> - 2002-12-04 08:24:57
|
On Tue, Dec 03, 2002 at 03:54:36PM -0200, Paulo Roberto wrote: > i try but don=B4t work... >=20 > Please send me one example.. >=20 > execute a program > send command > and pick up the screen and show in the web page >=20 #!/usr/bin/perl use Expect; # Print a valid http header. print "Content-Type: text/plain\n\n"; # Execute a shell $expect =3D Expect->spawn('sh'); # Send it a command print $expect "ls\n"; # Give it a second to run. Skip trying to match a prompt since the # prompt may be any of $#%>, and I'm too lazy to guess at a foolproof # regex. $expect->expect(1); =20 print "Listing: " . $expect->before(); Works for me. But the point is with a curses interface maybe the program doesn't redraw the whole screen, so you may not be able to just l= ook at $expect->before(). You'll have to try it and see. Don't forget to look at your web error logs. Austin |