Skip to content

How to use variables in commands with backticks? #1292

@PotatoesFall

Description

@PotatoesFall

I read the README and couldn't find this. If I missed it, apologies.

In Makefile, I could do this:

GIT_COMMIT := $(shell git rev-parse --short HEAD)
GIT_TIME := $(shell git show -s --format=%ci $(GIT_COMMIT) | tr -d '\n')

In just, I understand that backticks can be used to save the output of a command:

GIT_COMMIT := `git rev-parse --short HEAD`
GIT_TIME := `git show -s --format=%ci $(GIT_COMMIT) | tr -d '\n'`

however, the second command fails with /usr/bin/sh: GIT_COMMIT: command not found

The {{}} syntax also doesn't work here, how can I use a variable in a command?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions