I am trying to write a script which will add the JAVA_HOME path to bashrc. But I keep getting the wrong output.
Using the script below:
echo "export JAVA_HOME=/usr/lib/jvm/java-7-oracle" >> ~/.bashrc
echo "export PATH=$PATH:$JAVA_HOME/bin" >> ~/.bashrc
I get the output below in bashrc
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
export PATH=/home/ubuntu/apache-maven-3.3.9/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr$
The desired output is export PATH=$PATH:$JAVA_HOME/bin
for the path.
This script is not just intended for adding java path, I wan't to add path for hadoop, spark and hbase. I get same output for each of those. Any help would be appreciated.