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.

In reply to Re: run X-application via system call? by samizdat
in thread run X-application via system call? by rojam74

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.