When make runs this script, it does not pass the variable to the echo, but instead replaces $(foo) value foo .
Thus, the actual script is executed by echo hi...._ (points are being specified).
And spaces are simply ignored when parsing arguments for echo .
You can put double quotation marks so that it appears as a string.
echo "$(foo)_"
source share