This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sourcing a perl script on cygwin


I understand that I can call a shell script from a perl script by
using the command:

 exec("shell_script_name");

but when proceeding this way I don't have the environment variables
that were set in the perl script. Is there anther way to call the
shell script so that the shell child receives them?

Thanks,
Florin

On 6/27/08, Brian Dessent <brian@dessent.net> wrote:
> Florin Barbalau wrote:
>
>  > thanks for the explication. so I should understand that I can never
>  > run a perl script like this in order to set environment variables for
>  > the calling one ?
>  >
>  > I am very surprised about this problem because this is in the
>  > installation of an Oracle patch.
>
>
> I don't see how that could ever possibly hope to work.  In order to
>  execute perl, you have to create a perl process.  Any changes to the
>  environment that that perl process makes will be completely discarded
>  when it exits, i.e. it's impossible for a child to modify a parent's
>  environment.
>
>  Are you sure that the perl script wasn't intended to be the parent
>  process of the shell, i.e. it sets up a modified environment and then
>  drops you in a (sub)shell with those changes?  If that's the case then
>  simply execing the perl script should work.
>
>
>  Brian
>
>  --
>  Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>  Problem reports:       http://cygwin.com/problems.html
>  Documentation:         http://cygwin.com/docs.html
>  FAQ:                   http://cygwin.com/faq/
>
>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]