Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add a new repository to my Fedora and was asked to introduce the following command:

su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm'

I'm trying to understand what every part of the command means, and almost have it all, except for the line $(rpm -E %fedora). I googled it but found nothing, so I decided to ask here.

share|improve this question
up vote 3 down vote accepted

It runs the command rpm -E %fedora and substitutes its output from stdout into the outer command.

rpm -E evaluates the variable(s) in the text passed to it.

share|improve this answer
I see, so it returns the version of Fedora I am running. Thanks. – Sal Manning Dec 26 '13 at 2:49
$() is a better version of the increasingly deprecated `` subshell notation. – DopeGhoti Dec 26 '13 at 3:29

RPM Macros

When you have questions like this it's best to consult the man pages. Take a look at the rpm man page.

$ man rpm
   -E, --eval='EXPR'
          Prints macro expansion of EXPR.

Realizing that %fedora is a macro if you go a bit further down in the rpm man page you can see what files provide macro definitions.

Macro Configuration

Taking a peek inside of /etc/rpm/macros will reveal this definition.

$ grep fedora /etc/rpm/macros*
/etc/rpm/macros.dist:%fedora                19

So we can see that there is a definition called %fedora and on my system (Fedora 19) it has a value of "19".

Inline command execution

The notation $(..) will execute whatever command is between the parenthesis and substitute the returned results in their place.


$ echo $(echo hi)

Or in your case:

$ echo $(rpm -E %fedora)

Putting it all together

So when the command you're asking about runs the following things happen. A RPM macro, %fedora is evaluated using the rpm command. That command is executed in line. Once expanded to "19" that value is used within the larger yum command to install the appropriate .rpm file for a given version of Fedora.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.