#!/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 = ; print $result;