Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7810565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:49:45+00:00 2026-06-02T03:49:45+00:00

I have a spec file. I need to %define a spec variable that gets

  • 0

I have a spec file. I need to %define a spec variable that gets its value from a one line file on the system.

For example

%define path `cat /home/user/path_file`

and in path_file is one line

/var/www/html/hosts

This partially works. I say that begins in the RPM BUILD output sometimes the value of ${path} is literally my command cat /home/user/path_file and sometimes the value is the line in the path_file (/var/www/html/hosts) as it should be?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:49:47+00:00Added an answer on June 2, 2026 at 3:49 am

    You can define rpmbuild variables with %(cmd) at the top of the spec file. Notice the command is in parenthesis, not curly brackets. An example:

    %define whoami %(whoami)
    

    And elsewhere in the spec file, such as a script or the build/install sections, use the variable as normal in the curly brackets like this:

    echo "The user that built this is %{whoami}"
    

    The cmd can be anything, including your cat command. Be careful – when another user rebuilds the spec file it may not find the file. So it’ll be preferable to use the %{sourcedir} macro like this:

    %define path %(cat %{sourcedir}/path_file)
    

    And make sure that path_file is in the source directory and included as a source in the spec file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problems with an rpm spec file that is listing the same
Hi I have a file try.SPEC. This file contains a word Version: 1.0.0.1 .
I have a spec in my current project that requires us to advise the
I have almost the worst spec in the world. An application that exists and
Let's say that I have an Erlang function, with spec. -spec foo(integer(), string()) ->
OK, so I have a C++ project that compiles to a DLL file. I
Hi I am using Fedora 10 linux. I have created a .spec file now
I need to write a file format that writes out data to a file
I have a django view that I want to return an Excel file. The
I am using CentOS 5. I have created an rpm spec file for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.