I have a line in my ec2 instance user data that is seen below
cat <<EOT >> $HOME/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export HADOOP_HOME=$HOME/hadoop
export HADOOP_CONF=$HADOOP_HOME/etc
export PATH=$PATH:$JAVA_HOME:$HADOOP_HOME/bin
EOT
It is supposed to append to the ~/.bashrc file while inferring variable itself, but what is appended to the ~/.bashrc file looks like
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export HADOOP_HOME=/home/ubuntu/hadoop
export HADOOP_CONF=/etc
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin::/bin
The HADOOP_HOME variable works fine but the HADOOP_CONF and PATH variable is not what it supposed to be. My guess is it wasn't able to infer $HADOOP_HOME in both cases.
What can I do about this?
I've tried separating it like this
cat <<EOT >> $HOME/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export HADOOP_HOME=$HOME/hadoop
EOT
cat <<EOT >> $HOME/.bashrc
export HADOOP_CONF=$HADOOP_HOME/etc
export PATH=$PATH:$JAVA_HOME:$HADOOP_HOME/bin
EOT
I've also tried to surround the $HADOOP_HOME in quotes too