Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: How to "source" a shell file in Perl?

by LanX (Canon)
on Jun 12, 2013 at 20:04 UTC ( #1038572=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open my $source,'-|',"bash /tmp/wrapper.sh" or die "$!";
    
    ...
    eval $dump;
    
    print $VAR1->{MONK};  #> jfroebe
    
  2. or download this
    lanx@nc10-ubuntu:/tmp$ cat wrapper.sh 
    . /tmp/src.sh
    ...
    export MONK=jfroebe
    
    lanx@nc10-ubuntu:/tmp$ 
    
  3. or download this
    my $bashcode=<<'_bash_';
    . /tmp/src.sh;
    ...
    eval $dump;
    
    print $VAR1->{MONK};  #> jfroebe
    
  4. or download this
    my $bashcode=<<'__bash__';
    . /tmp/src.sh;
    ...
    eval qx{bash -c "$bashcode"};
    
    print $VAR1->{MONK};  #> jfroebe
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1038572]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2014-07-13 08:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (248 votes), past polls