1

So, I've got a bunch of export ... environment variable lines in my .bashrc, and I would like to call some programs (specifically Jupyter notebook) that need access from those notebooks from screen, and furthermore a screen that is initially detached.

I initially tried (in a script called jupyter.sh)

screen -dRR foobar jupyter notebook --no-browser

but since the detached screen is neither login nor interactive neither .bash_profile (which just sources .bashrc) nor .bashrc itself were sourced and so my notebook didn't have access to the definitions in them.

Then I tried digging into .screenrc, but it doesn't seem like there's an equivalent export command for screenrc, so I decided as a workaround to use a second bash script, ._juypter, that just manually calls source before calling Jupyter notebook:

#!/bin/bash
source .bashrc
jupyter notebook --no-browser

But that didn't work either, and I really don't know why. I think it's the source command that isn't doing what I want - if I insert echo $LD_LIBRARY_PATH$ in between source and juypter I get an empty line at the top of my new screen, and if I put echo "foobar" into my .bashrc I don't see anything when the screen loads.

The really weird thing is, while making a new variable export $FOOBAR="baz" in my .bashrc and trying to echo $FOOBAR doesn't work either as expected, if I then source .bashrc manually before running the screen script jupyter.sh, then the echo $FOOBAR does work - I get a baz at the top of the screen! But even then, the thing I actually want, echo $LD_LIBRARY_PATH, doesn't. So now I'm very confused. Any help?

1 Answer 1

0

Bash syntax:

FOOBAR="baz"

You have:

$FOOBAR="baz"

Can you upload a snapshot of your current scripts to a hosting web service so that we can look at them?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .