[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: environment variables
From: |
Aaron Davies |
Subject: |
Re: environment variables |
Date: |
Wed, 11 Dec 2013 22:36:51 -0500 |
On Dec 11, 2013, at 6:06 AM, Nico Schlömer wrote:
> David T. Pierson <address@hidden> wrote:
>
>> 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?
shell initialization is weird, tricky, and annoying
things to check:
is LD_LIBRARY_PATH exported? try "export | grep LD_LIBRARY_PATH". if not,
change your .bashrc to export it.
how is your .bashrc called? the default rule in bash 3.2 (the man page i have
most direct access to at the moment) is "When an interactive shell that is not
a login shell is started, bash reads and executes commands from ~/.bashrc, if
that file exists."
how is screen launching your shell? is the screen "shell" config "bash" or
"-bash"? is it set at all, or is it defaulting to $SHELL?
do you call your .bashrc from your .bash_profile? (do you *have* a .bash_login
or .profile?) a very common bash idiom is to have "[[ -f ~/.bashrc ]] && .
~/.bashrc" in .bash_profile.
is this OS X or linux/bsd/cygwin windows/something else? i've heard reports of
shell initialization differences in OS X zsh, so there might be issues in bash
too.
--
Aaron Davies
address@hidden