【发布时间】:2019-03-11 06:35:29
【问题描述】:
我正在向 makefile 目标传递一个参数。我想做参数的字符串比较。这是我的代码,
mode = p
install:
@echo mode is $(mode)
ifeq ($(mode),"p")
@echo mode is production
else
@echo mode is development
endif
我收到以下错误,
mode is d
ifeq (d,"p")
/bin/sh: 1: Syntax error: word unexpected (expecting ")")
什么是错误以及在 bash 脚本中比较字符串的一般规则是什么?
【问题讨论】:
-
另一个问题 - “你是如何通过模式制作的?”
make mode=d ...? -
make mode=d install