[Haskell-cafe] How to add ENV variable in runhaskell shell script

Cale Gibbard cgibbard at gmail.com
Mon Jan 14 01:04:07 EST 2008


On 13/01/2008, Steve Lihn <stevelihn at gmail.com> wrote:
> Hi,
> In perl scripts (unix), one can do
> ==
> #!/usr/local/bin/perl
> BEGIN {
>   $ENV{LD_LIBRARY_PATH} = ...;
> }
>   do my perl stuff
> ==
> The setting of ENV variable before the program runs allows me to fix
> the shell environments. In this case, I need to specify where to look
> for the shared library.
>
> How do I do this in Haskell if I am writing the same script using:
> ==
> #!/path/to/runhaskell
>   {-
>      how to set LD_LIBRARY_PATH = ... ?
>   -}
>
>   do my haskell stuff
> ==
>
> Thanks,
> Steve

In System.Posix.Env there is a function setEnv which will let you set
environment variables. I have no idea why this functionality is not
exposed in System.Environment.

 - Cale


More information about the Haskell-Cafe mailing list