張世勳
張世勳

Reputation: 55

How do I remove 1 char in makefile

I want to remove a character of string in makefile, for example

FOO = 123-456-789-
all:
  # want to display 123-456-789
  echo "$(FOO)"

I want to remove the last char in sting "-", which mean how to let "123-456-789-" become "123-456-789"

thanks

Upvotes: 5

Views: 6751

Answers (1)

ichramm
ichramm

Reputation: 6642

Since you know the character you want to replace, the following snippet must work:

FOO = 123-456-789-

all:
        echo $(FOO:-=)

Upvotes: 8

Related Questions