Friday, December 1, 2017

shell - Environment variables which were defined in bashrc aren't accessible to /bin/bash

I've defined variables in /etc/bashrc in the following matter:


export VAR1=yadayada

I have bash script called runner.sh with the following code below => we run there another script called run_test.sh which is launching a python script. The python script uses the env variable mentioned above.


Here is runner.sh content:


#!/bin/bash
exec /home/john/run_test.sh

When launching runner.sh from shell I get an error that env variable is not defined.


If I launch the same runner.sh from crontab, with having the env variable defined also in the crontab everything goes right.


Can you please explain why from shell run we are not "collecting" the env variable from bashrc, and how it can be fixed?

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...