Using GNU’s make, I’d like to extract the first character of a variable. Currently I’m using the shell function to have bash perform the substring. I’m wanting to know if there is a way using gmake’s built-ins to do the same.
DIR=/user/$(shell echo "$${USER:0:1}")/$(USER)/
It’s not very satisfying, and you’d have to add to
$(INITIALS)until you were happy, but:Perhaps the sensible approach would be to take note of the
:=usages in the above, and amend your simple version toDIR := ...$(shell ...)...so that the shell command is only invoked once.