Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux - environment variables $HOME versus $(HOME)

Recently I had to update my JAVA environment variable in .bashrc

echo $JAVA_HOME # prints out /usr/java/...

echo $(JAVA_HOME) # raises error "can't find JAVA_HOME command"

I'm worried that my make file, which uses $(JAVA_HOME) won't work since $JAVA_HOME gets recognized, but not $(JAVA_HOME)

How can I get $(JAVA_HOME) to equal $JAVA_HOME, which is currently set? Also, why does this happen?

thanks

like image 349
Kevin Meredith Avatar asked Nov 29 '22 05:11

Kevin Meredith


1 Answers

make is not bash

They deal with variables differently. $foo is how you read a variable called foo in bash, and $(foo) is how you read it in a makefile.

like image 70
Quentin Avatar answered Dec 04 '22 13:12

Quentin