I'm new to linux. I'm seeing a bash command (is that even the right term?) that sets JAVA_HOME
environment variable at the prompt:
export JAVA_HOME =$(readlink -f /usr/bin/java |sed "s:bin/java::")
I know what the command inside $()
does. But what is the $()
for? It failed if I didn't include it.
Obviously googling $()
doesn't work very well.
$()
is called command substitution. It replaces the output of a command with the command itself.
There are basically two ways you can do command substitution:
$(command)
or with backticks
`command`
The first variant is the preferred one.
You can read more about command substitution here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With