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 8183117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:03:54+00:00 2026-06-07T01:03:54+00:00

At a BASH prompt, I can do the following: ~/repo$ HISTORY_LOG=$(git log $(get_old_version)..$(get_new_version)); [[

  • 0

At a BASH prompt, I can do the following:

~/repo$ HISTORY_LOG=$(git log $(get_old_version)..$(get_new_version)); [[ ! -z ${HISTOR_LOG} ]] && ( echo "Some header"; echo "${HISTORY_LOG}" )

Where git log is demonstrably simplified version of what I actually have.

In a make file I have the following command as part of a target:

$(OUTPUT): $(INPUT)
        ...
        echo "Some header" > $(LOG_FILE)
        git log $(shell get_old_version)..$(shell get_new_version) >> $(LOG_FILE)

How can I rewrite the make target to behave like the bash command?

If I do the following line-feeds are being stripped:

$(OUTPUT): $(INPUT)
        ...
        HISTORY_LOG="$(shell git log $(shell get_old_version)..$(shell get_new_version))" ; \
           [ -z "$${HISTORY_LOG}" ] && \
             true || \ 
             (echo "Some header" ; echo "$${HISTORY_LOG}" )

when run looks like:

~/repo $ make
commit 2b4d87b0e64d129028c1a7a0b46ccde2f42c5e93     Author: Jamie   <Jamie@mymail.com>   Date:   Mon Jun 25 18:46:27 2012 -0400              Issue #468: This sucker's been sped up.

and what I prefer would be:

~/repo $ make
commit 2b4d87b0e64d129028c1a7a0b46ccde2f42c5e93     
Author: Jamie   <Jamie@mymail.com>
Date:   Mon Jun 25 18:46:27 2012 -0400 

    Issue #468: This sucker's been sped up.

I think the issue is the that make executes commands in /bin/sh and not /bin/bash. Regardless I’m looking for a portable solution if there is one.

  • 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-07T01:03:55+00:00Added an answer on June 7, 2026 at 1:03 am

    Make’s shell is eating your newlines. Just stop using it. Instead of $( shell get_old_version ), escape the $:

    $$( get_old_version )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm customizing my bash prompt on OsX to include git branch plus some marks
In Bash I can easily do something like command1 && command2 || command3 which
On bash or Window's Command Prompt, we can press the up arrow on keyboard
In bash, some commands put their stdout BEFORE the command prompt and on the
at the bash prompt I can perform this copy cp file.txt test1.txt but if
How can I make the Win-Bash prompt always print the current folder? I want
For example look at the following line of bash-code eval `echo ls *.jpg` It
I've hacked my bash prompt to (in theory) tell me what git branch I'm
I wanted to use one of the Git-completion.bash features but I can't customize the
Using a script, I was to change the prompt of the parent Bash shell.

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.