Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Below is the output of the script.#!/usr/bin/perl use warnings; use strict; use IPC::Open3; $|=1; # set \*ERR to 0 to send STDERR to STDOUT my $pid=open3 (\*IN, \*OUT , 0, '/bin/bash' ); my $cmd = qq( export PS1="\e[0;31m[\u@\h \W]$ \e[m " ); print IN "$cmd\n"; # Send cmd to bash. my $result = <OUT>; print $result;
Line 12 is the bash command to change the prompt to red. Also, it is hanging after I ran the script. What am I doing wrong here??Unrecognized escape \h passed through at 11.pl line 12. Unrecognized escape \W passed through at 11.pl line 12. Use of uninitialized value in concatenation (.) or string at 11.pl lin +e 12.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Send Bash Command
by sauoq (Abbot) on Mar 03, 2010 at 01:01 UTC | |
by Anonymous Monk on Mar 03, 2010 at 01:08 UTC | |
by spazm (Monk) on Mar 03, 2010 at 07:49 UTC | |
|
Re: Send Bash Command
by Anonymous Monk on Mar 03, 2010 at 01:00 UTC | |
|
Re: Send Bash Command
by Khen1950fx (Canon) on Mar 03, 2010 at 06:57 UTC | |
by bichonfrise74 (Vicar) on Mar 03, 2010 at 19:03 UTC | |
by Khen1950fx (Canon) on Mar 03, 2010 at 21:48 UTC | |
|
Re: Send Bash Command
by Anonymous Monk on Mar 03, 2010 at 01:04 UTC | |
by Anonymous Monk on Mar 03, 2010 at 01:05 UTC | |
by Anonymous Monk on Mar 03, 2010 at 01:09 UTC | |
by Anonymous Monk on Mar 03, 2010 at 01:20 UTC | |
by Anonymous Monk on Mar 03, 2010 at 02:35 UTC | |
|