http://www.perlmonks.org?node_id=951102


in reply to Re: Run a shell command in a new terminal from a perl script?
in thread Run a shell command in a new terminal from a perl script?

I am running this script on Ubuntu

The script I am writing pulls a few command line programs together. I want to be able to have one of the programs run in a new terminal while my main program continues to run in the first terminal.

  • Comment on Re^2: Run a shell command in a new terminal from a perl script?

Replies are listed 'Best First'.
Re^3: Run a shell command in a new terminal from a perl script?
by Khen1950fx (Canon) on Feb 01, 2012 at 01:37 UTC
    It can be done, but it's tricky. Here's a script that I wrote to test Module::Install and ExtUtils::MakeMaker.
    #!/usr/bin/perl -l use strict; use warnings; $|=1; open STDOUT, '>-'; system("xterm -e cpan -ft Module::Install &"); close STDOUT; use CPAN; CPAN::Shell->test("ExtUtils::MakeMaker");

    Update: The script requires a lot of RAM, so it may or may not work for you. Try some other commands until it works.

    Update: This will probably work better for you.
    #!/usr/bin/perl -l use strict; use warnings; $| =1; open STDOUT, '>-'; system("du /usr/lib/perl5 &"); close STDOUT; open STDOUT, '>-'; system("xterm -e du /usr/lib/perl5 &"); close STDOUT;

      That did not work.

      I got an error saying: sh: xterm: command not found

        You need to install xterm.
        sudo apt-get install xterm

        Or get the source:

        xterm