Skip to content

Instantly share code, notes, and snippets.

@nobiki
Last active November 19, 2019 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nobiki/8ac4bf48a1e7d9dc465888aa3176cb49 to your computer and use it in GitHub Desktop.
Save nobiki/8ac4bf48a1e7d9dc465888aa3176cb49 to your computer and use it in GitHub Desktop.
make substr
#!/bin/bash -eu
SEARCH := localhost 127.0.0.1
is_local := $(words $(filter $(DOCKER_HOST), $(SEARCH)))
# 未指定
ifeq ($(DOCKER_HOST),)
FOO="empty"
# ローカルではない
else ifeq ($(is_local),0)
FOO="not local"
# ローカル
else
FOO="is local"
endif
hoge:
@echo ${FOO}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment