Are you wanting to open up an xterm window to run
this? If so, try the following:
use strict;
use warnings;
my $title = 'xterm example';
my $msg = 'press any key to continue ...';
my $exec = 'ls';
my $cmd = qq{xterm -T "$title" -e "$exec && read -p '$msg' -n1"};
my $rc = qx{$cmd};
| [reply] [d/l] |
| [reply] |
As an expansion of randyk's posting, here are a few more variants:
Run without user input:
system("xterm -e bash --rcfile /path/to/my/file.pl")
&& die "XTERM FAIL: $!\n";
Run and continue main prog operation:
system("xterm -e bash --rcfile /path/to/my/file.pl &")
&& die "XTERM FAIL: $!\n";
Execute your prog, fire off another command, and leave the xterm open with a new shell:
system("xterm -e bash --rcfile /path/to/my/file.pl -i -c \"$acommandst
+ringtoexec && exec bash\" &")
&& die "XTERM FAIL: $!\n";
This was originally designed as part of a large shell script (mentioned in the thread Just hammering nails...). In the original rcfile, numerous ENV variables are set so that the new shell has what it needs in terms of PATHs and settings in order to run. The third variant allows both an rcfile and a command-line string to be executed and the window to remain open for further processing, an extremely powerful combination. I'm definitely not a shell script guru, but this was fun to write. The --rcfile option is bash2-specific, as are the interpretation of the -i and -c switches, but the final shell left open can be any shell or shell-like program, leaving you with three possible execution points. | [reply] [d/l] [select] |