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

  • Home
  • SEARCH
  • 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 6096879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:58:41+00:00 2026-05-23T12:58:41+00:00

I am running the following inside the makefile:- @START=$(shell date +%s) && \ echo

  • 0

I am running the following inside the makefile:-

@START=$(shell date +%s) && \
echo $${START} &&\
sleep 10s && \
END=$(shell date +%s) && \
echo "$${END} $${START}" &&\
DIFF_SUB=$$(($$END - $$START)) && \
echo IT TOOK $${DIFF_SUB} SECONDS

and it outputs to the following:-

1309950228
1309950228 1309950228
IT TOOK 0 SECONDS

  • 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-05-23T12:58:42+00:00Added an answer on May 23, 2026 at 12:58 pm

    The reason you are getting the same result for each $(shell date +%s) is that each is being executed and substituted at the same time – that is when make is running the command.

    After make does its substitutions, this is the command the shell sees:

    @START=1309950228 && \
    echo ${START} &&\
    sleep 10s && \
    END=1309950228 && \
    echo "${END} ${START}" &&\
    DIFF_SUB=$(($END - $START)) && \
    echo IT TOOK ${DIFF_SUB} SECONDS
    

    If you want the date command to be run twice with a 10 second time difference between them, you will need the shell to perform the command substitution, not make:

    @START=$$(date +%s) && \
    echo $${START} &&\
    sleep 10s && \
    END=$$(date +%s) && \
    echo "$${END} $${START}" &&\
    DIFF_SUB=$$(($$END - $$START)) && \
    echo IT TOOK $${DIFF_SUB} SECONDS
    

    Note the double $$ and the removal of the shell make command.

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

Sidebar

Related Questions

I'm following this example to get Spring up & running: http://static.springsource.org/docs/Spring-MVC-step-by-step/part2.html What they do
The following code gives different output when running the release inside Visual Studio, and
I'm running the following SQL inside a cfquery tag INSERT INTO Meeting_RFPMeetings (RFP_ID, Meeting_ID,
I am running following PHP code to interact with a MS Access database. $odbc_con
Running the following vbscript to call svnadmin dump fails (i.e. no dump is being
Running the following code, I get a StackOverflowError at the getPackage() line. How can
When running the following code it leaves out one row. When I do a
When running the following Java code, I get very accurate and consistent results in
When running the following python code: >>> f = open(rmyfile.txt, a+) >>> f.seek(-1,2) >>>
When running the following class the ExecutionService will often deadlock. import java.util.ArrayList; import java.util.Collection;

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.