Re: source bash config from perl code

2009-10-05 Thread Oleg Goldshmidt
This has gotten out of hand, I think. The OP wanted to run a perl script in a custom environment set in a bash script, and we went off on a tangent in the direction of something quite general. This is a very good example of how an attempt to create a general, portable, robust solution for

Re: source bash config from perl code

2009-10-03 Thread Tzafrir Cohen
On Fri, Oct 02, 2009 at 08:59:37AM +0200, Noam Meltzer wrote: On Thu, Oct 1, 2009 at 12:57 PM, Tzafrir Cohen tzaf...@cohens.org.ilwrote: 3. You still need to export the variables to make them available in the environment of the shell script: export $EXPORTED_VARS Well, not

Re: source bash config from perl code

2009-10-03 Thread Tzafrir Cohen
On Fri, Oct 02, 2009 at 11:33:52AM +0200, Oleg Goldshmidt wrote: Noam Meltzer tsn...@gmail.com writes: On Thu, Oct 1, 2009 at 12:57 PM, Tzafrir Cohen tzaf...@cohens.org.il wrote: 3. You still need to export the variables to make them available in the

Re: source bash config from perl code

2009-10-03 Thread Oleg Goldshmidt
Tzafrir Cohen tzaf...@cohens.org.il writes: Having to export what you explicitly set is a strange habbit for a configuration format. Why? Doesn't your ~/.bash_profile export what it needs to? #!/bin/bash function die() { Nit #1: you can get rid of 'function' and save a whole word while

Re: source bash config from perl code

2009-10-03 Thread Tzafrir Cohen
On Sat, Oct 03, 2009 at 08:17:49PM +0200, Oleg Goldshmidt wrote: Tzafrir Cohen tzaf...@cohens.org.il writes: Having to export what you explicitly set is a strange habbit for a configuration format. Why? Doesn't your ~/.bash_profile export what it needs to? That file is not merely a

Re: source bash config from perl code

2009-10-02 Thread Noam Meltzer
On Thu, Oct 1, 2009 at 12:57 PM, Tzafrir Cohen tzaf...@cohens.org.ilwrote: 3. You still need to export the variables to make them available in the environment of the shell script: export $EXPORTED_VARS Well, not necessarily. At least in bash (I didn''t check /bin/sh), you can use 'set -a'

Re: source bash config from perl code

2009-10-02 Thread Oleg Goldshmidt
Noam Meltzer tsn...@gmail.com writes: On Thu, Oct 1, 2009 at 12:57 PM, Tzafrir Cohen tzaf...@cohens.org.il wrote: 3. You still need to export the variables to make them available in the environment of the shell script:  export $EXPORTED_VARS Well, not

Re: source bash config from perl code

2009-10-01 Thread Tzafrir Cohen
On Wed, Sep 30, 2009 at 05:57:39PM +0200, Itay Donenhirsch wrote: here's an idea - change the callee script to a bash script which sources the config file, and then call the real perl script. something along: #!/bin/bash source config.env ./script.pl $* 1. bashism: you meant: #!/bin/sh

Re: source bash config from perl code

2009-10-01 Thread Itay Donenhirsch
thanks for the tips :) On Thu, Oct 1, 2009 at 12:57 PM, Tzafrir Cohen tzaf...@cohens.org.il wrote: On Wed, Sep 30, 2009 at 05:57:39PM +0200, Itay Donenhirsch wrote: here's an idea - change the callee script to a bash script which sources the config file, and then call the real perl script.

source bash config from perl code

2009-09-30 Thread Alexander Indenbaum
Hello, I have bash script which alters environment, kind of configuration, let's say config.env. I'd like to import this environment in context of perl script. How do I do equivalent to 'source config.env' from perl code? I mean I could just run bash in subprocess, but it would not alter perl

Re: source bash config from perl code

2009-09-30 Thread Tzafrir Cohen
On Wed, Sep 30, 2009 at 04:48:41PM +0200, Alexander Indenbaum wrote: Hello, I have bash script which alters environment, kind of configuration, let's say config.env. I'd like to import this environment in context of perl script. How do I do equivalent to 'source config.env' from perl

Re: source bash config from perl code

2009-09-30 Thread Oleg Goldshmidt
On Wed, Sep 30, 2009 at 4:48 PM, Alexander Indenbaum alexander.indenb...@gmail.com wrote: Hello, I have bash script which alters environment, kind of configuration, let's say config.env. I'd like to import this environment in context of perl script.  How do I do equivalent to 'source

Re: source bash config from perl code

2009-09-30 Thread Itay Donenhirsch
here's an idea - change the callee script to a bash script which sources the config file, and then call the real perl script. something along: #!/bin/bash source config.env ./script.pl $* -- itay On Wed, Sep 30, 2009 at 5:09 PM, Tzafrir Cohen tzaf...@cohens.org.il wrote: On Wed, Sep 30, 2009

Re: source bash config from perl code

2009-09-30 Thread Shlomi Fish
On Wednesday 30 Sep 2009 17:52:34 Oleg Goldshmidt wrote: On Wed, Sep 30, 2009 at 4:48 PM, Alexander Indenbaum alexander.indenb...@gmail.com wrote: Hello, I have bash script which alters environment, kind of configuration, let's say config.env. I'd like to import this environment in