I ran into a weird problem. I put some env variables into .bashrc
and it works as it should:
echo $HADOOP_HOME
/home/me/dist/hadoop
But the env variable is not accessible when executing bash scripts. Suppose I create /tmp/sample.sh
with below content:
#! /bin/bash
echo $HADOOP_HOME
When I run above script, echoes an empty line:
/tmp/sample.sh
.bashrc
? My guess is you're notexport
ing:export HADOOP_HOME=/home/me/dist/hadoop
, when you run/tmp
sample.sh` (which spawns a newbash
with a new environment) HADOOP_HOME isn't in the new environment. – John N Dec 10 '16 at 13:54