Re: environment variables

Nico Schlömer <[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <CAK6Z60dD111qCmPTh-C47=PkOPoFsG7vj9D4=4iEQffDxzLM+g@mail.gmail.com>
> If you want different behavior, please be more specific
> about what you are really trying to accomplish.

I would like to execute a program in a shell that needs a custom path
added to  LD_LIBRARY_PATH. This happens in my .bashrc by default, so
on the regular non-screen shell I'm getting no problems.
On a detached screen however, the program will not execute with an
error message related to an incomplete LD_LIBRARY_PATH. Indeed,

$ env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/home/nschloe/Work/FEniCS/lib/:/opt/trilinos/dev/openmpi/1.4.3/gcc/4.6.3/release/shared/lib/:/opt/netcdf/4.2.1.1/lib/:/home/nschloe/Work/FEniCS/lib:
$ screen -L -d -m sh -c "env | grep LD_LIBRARY_PATH"
$ cat screenlog.0
$

so LD_LIBRARY_PATH doesn't seem to be defined in the detached shell at all.
It *does* get set in attached shells though.

Any workaround for it?

--Nico







On Sat, Dec 7, 2013 at 6:23 AM, David T. Pierson <dtp-tWP3OOf8k3DqlBn2x/[email protected]> wrote:
> On Thu, Dec 05, 2013 at 10:08:36PM +0100, Nico Schlömer wrote:
>> I get
>>
>> $ screen
>> --> screen
>> $ echo $FOO
>> bar
>>
>> but a detached shell yields nothing:
>>
>> $ screen -s /bin/bash -L -d -m echo $FOO
>> $
>
> There are a couple of things to say here.
>
> The lack of output has nothing to do with the environment variable.  The
> echo command is running within the new screen session, to which you are
> not attaching (and which will exit after echo exits.)  So nothing should
> appear as output in the current shell.  Try:
>
>   $ screen -d -m echo foo
>
> to see the same thing (nothing) in your current shell.
>
> However, since you used -L to enable logging, you should see the output
> in the log.
>
> Finally, note that $FOO gets expanded by the current shell before screen
> is invoked.  If you want different behavior, please be more specific
> about what you are really trying to accomplish.
>
> David
> is invoked.  If you want different behavior, please be more specific
> about what you are really trying to accomplish.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.