I couldn't find any information on that "TBterm" application, so I'll have to ask more questions.
I really want to spawn a xterm, because the TBterm cmd will pop up a xterm window with special setting.What kind of special settings are specified in xterm spawned by TBterm? Does it spawn an xterm when run in another terminal?
how to open a process of "TBterm" backgroundlySo, you need to run TBterm in background (with no visible terminal), or not in background, but in an xterm?
I'll try to solve the problem as I understand it now, using sh as an interactive application and "ls" as a command:
#!/usr/bin/perl use warnings; use strict; use Expect; print("STDIN is not a terminal, running xterm\n"), exec ('xterm', '-e' +, $^X, $0, @ARGV) unless -t STDIN; print "Surely running in a terminal\n"; my $expect = Expect::->spawn("/bin/sh") or die "bash: $!\n"; $expect->expect(1,"\$ "); # expect a command line prompt $expect->send("ls\n"); $expect->expect(1,"ls\r\n"); # sh echoes the entered command, so I hav +e to expect() it back # need to play with $expect->slave->stty() to get rid of \r $expect->expect(1,"\$ "); # expect another command line prompt meaning + that the command succeeded my $result = $expect->before(); # catch everything in between the echo +ed "ls" and new prompt $expect->send("exit\n"); # terminate the shell properly $expect->soft_close; print "Gathered output: BEGIN\n$result\nEND\n";
In reply to Re^5: I want to call a special xterm to execute "ls" command in a perl script
by aitap
in thread I want to call a special xterm to execute "ls" command in a perl script
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |