source bash config from perl code

source bash config from perl code

Noam Meltzer tsnoam at gmail.com
Fri Oct 2 08:59:37 IST 2009


On Thu, Oct 1, 2009 at 12:57 PM, Tzafrir Cohen <tzafrir at 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 necessarily.
At least in bash (I didn''t check /bin/sh), you can use 'set -a' to
automatically mark variables and functions which are modified or created for
export to the environment of subsequent commands. (so knowing the variables
ahead is not a must)

so:
#!/bin/bash
set -a
. config.env
exec ./script.pl "$@"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20091002/cc57f17d/attachment-0001.html>


More information about the Linux-il mailing list