I’ve learned about string manipulation with bash, and more especially about substring replacement:
#! /bin/bash
VAR1="aaaa.bbbb.cccc"
VAR2="bbbb*"
echo ${VAR1%${VAR2}}
This bash script prints “aaaa.”. I tried to include it in my makefile, but I can’t make it work..
SHELL:=/bin/bash
VAR1="aaaa.bbbb.cccc"
VAR2="bbbb*"
all:
@echo $${VAR1%$${VAR2}}
This Makefile only prints a blank line.
I think I’ve misunderstood something, but can’t figure out what. Any help would be really appreciated.
No need to put double quotes around VAR1 and VAR2. And you need to use
exportif you want to put VAR1 and VAR2 aboveall: