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


in reply to Re: perl scripting help
in thread perl scripting help

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: perl scripting help
by kcott (Archbishop) on Jun 02, 2021 at 07:03 UTC

    Your post is virtually unreadable. Why did you post it like this? Surely you saw this in the initial preview along with the message: "If something looked unlike you expected it to you might need to check out Writeup Formatting Tips". Please follow that link and also read "How do I post a question effectively?" before posting again.

    I created a new directory ~/tmp/pm_11133222_test_dir and this file:

    ken@titan ~/tmp $ cat > pm_11133222_rcfile . ~/.bashrc cd ~/tmp/pm_11133222_test_dir

    I modified the script I originally gave you. It's now:

    #!/usr/bin/env perl use strict; use warnings; use autodie ':all'; my @commands = ( 'set -vx', 'pwd', "cd $ENV{HOME}", 'pwd', 'date', "/usr/bin/bash --rcfile $ENV{HOME}/tmp/pm_11133222_rcfile -i", ); system qw{/usr/bin/xterm -e}, join ';', @commands;

    When I run that, I get an xterm window with this content:

    + pwd /home/ken/tmp + cd /home/ken + pwd /home/ken + date Wed, 2 Jun 2021 16:38:27 + /usr/bin/bash --rcfile /home/ken/tmp/pm_11133222_rcfile -i ken@titan ~/tmp/pm_11133222_test_dir $

    All of my previous comments about the script being blocked and exiting from the xterm still apply.

    — Ken