The Makefile utilizes a feature ,[[, of the Bash shell. Yet, it leaves the SHELL variable uninitialized, which means that make will default to sh, which does not support the bash-specific [[ keyword.
$ sh -c 'type [['
[[: not found
$ bash -c 'type [['
[[ is a shell keyword
This results in an awkward, preventable error:
🐋 ❯ make prepare NAME=bar REPOSITORY=github.com/mario-campos/pulumi-bar-native ORG=mario-campos
mv "provider/cmd/pulumi-resource-xyz" provider/cmd/pulumi-resource-bar # SED_SKIP
if [[ "Linux" != "Darwin" ]]; then \
find . \( -path './.git' -o -path './sdk' \) -prune -o -not -name 'go.sum' -type f -exec sed -i '/SED_SKIP/!s,github.com/pulumi/pulumi-[x]yz,github.com/mario-campos/pulumi-bar-native,g' {} \; &> /dev/null; \
find . \( -path './.git' -o -path './sdk' \) -prune -o -not -name 'go.sum' -type f -exec sed -i '/SED_SKIP/!s/[xX]yz/bar/g' {} \; &> /dev/null; \
find . \( -path './.git' -o -path './sdk' \) -prune -o -not -name 'go.sum' -type f -exec sed -i '/SED_SKIP/!s/[aA]bc/mario-campos/g' {} \; &> /dev/null; \
fi
/bin/sh: 1: [[: not found
# In MacOS the -i parameter needs an empty string to execute in place.
if [[ "Linux" == "Darwin" ]]; then \
find . \( -path './.git' -o -path './sdk' \) -prune -o -not -name 'go.sum' -type f -exec sed -i '' '/SED_SKIP/!s,github.com/pulumi/pulumi-[x]yz,github.com/mario-campos/pulumi-bar-native,g' {} \; &> /dev/null; \
find . \( -path './.git' -o -path './sdk' \) -prune -o -not -name 'go.sum' -type f -exec sed -i '' '/SED_SKIP/!s/[xX]yz/bar/g' {} \; &> /dev/null; \
find . \( -path './.git' -o -path './sdk' \) -prune -o -not -name 'go.sum' -type f -exec sed -i '' '/SED_SKIP/!s/[aA]bc/mario-campos/g' {} \; &> /dev/null; \
fi
/bin/sh: 1: [[: not found
How to fix? This PR sets the SHELL variable in the Makefile to /bin/bash to ensure that the [[ keyword is available.
The Makefile utilizes a feature ,
[[
, of the Bash shell. Yet, it leaves theSHELL
variable uninitialized, which means thatmake
will default tosh
, which does not support the bash-specific[[
keyword.This results in an awkward, preventable error:
How to fix? This PR sets the
SHELL
variable in the Makefile to/bin/bash
to ensure that the[[
keyword is available.