in reply to perl scripting help

I don't use gnome-terminal but this works for me with xterm. It should get you started, anyway.

#!/usr/bin/env perl use strict; use warnings; system ('xterm', '-e', 'ls && sleep 10');

🦛

Replies are listed 'Best First'.
Re^2: perl scripting help
by cavac (Prior) on May 28, 2021 at 16:04 UTC

    Hmm, if OP wants to have an interactive terminal that just executes some commands before dropping to the command line, something like this should work:

    system('xterm', '-e', 'bash -rcfile /home/username/script.sh');

    perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'
Re^2: perl scripting help
by ejm20 (Initiate) on Jun 01, 2021 at 14:41 UTC
    The xterm does open but closes after the sleep command. How can it stay open? Thanks!!!

      The same way you would without using Perl at all. eg:

      system ('xterm', '-e', 'ls && read line');

      will happily leave the xterm open indefinitely until the user closes it (or submits a line).


      🦛