question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Variable and command substitution

See original GitHub issue

In Makefile we could substitute a command with an variable, and running with alternatives: make CC=clang++ test:

CC = g++
test:
  $(CC) foo.cc

Though this is related to Makefile syntax, it might still be worth to consider it. XD

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kennethreitzcommented, Sep 19, 2019

Now, the following works:

CC='g++'

test:
   ${CC} foo.cc

✨ 🍰 ✨

2reactions
kennethreitzcommented, Sep 19, 2019

This currently works!

test:
   ${CC} foo.cc

CC='g++'

Not when it’s above the tasks. Should be easy to correct (need some regex or something!).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bash variables and command substitution
Command substitution allows the output of a command to replace the command itself. Bash performs the expansion by executing command and replacing the...
Read more >
Command Substitution - The Linux Documentation Project
Command substitution permits setting a variable to the output of a loop. The key to this is grabbing the output of an echo...
Read more >
Quoting within $(command substitution) in Bash
In my Bash environment I use variables containing spaces, and I use these variables within command substitution.
Read more >
Use Variable in Command Substitution - bash - Stack Overflow
Variables are not substituted within single quotes. You have to use double quotes in this case: for i in {1..3}; do HTML=$( curl...
Read more >
Difference between ${} and $() in Bash | Baeldung on Linux
Command substitution in Bash allows us to execute a command and substitute it with its standard output. Note this command executes within a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found