Decipher command

I wanted to install VirtualBox Guest Additions in Fedora. I found the command

yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r) dkms gcc gcc-c++

After running the above command Guest Additions install, but I'd like to know what the command is doing specifically $(uname -r). I understand kernel-devel, gcc, and gcc-c++ are getting installed but what's the $(uname -r) doing?

Thank you.

Really not accurate but $(command) just executes command and replaces itself with the output. So "uname -r" prints the kernel version number the system is using currently. Assuming you're on kernel 4.0.0 the whole command becomes:

yum install kernel-devel-4.0.0 kernel-headers-4.0.0 dkms gcc gcc-c++

edit: just to make it clear: your console emulator (probably bash) is executing "uname -r" before executing the whole command which means that yum doesn't even know you were using $(uname -r) somewhere for the arguments.

Thank you.

1 Like