【发布时间】:2012-12-18 11:17:03
【问题描述】:
我的同事用的是Ubuntu,我用的是openSUSE,我们用同样的makefile编译了同样的源代码,我的环境运行良好,但是我的同事不行,总是输出无法识别的-e选项。我们检查makefile,只发现echo命令使用-e选项。
Dose Ubuntu 的 echo 功能和其他的不一样?
+++++更新 在makefile中,echo定义为:
TOOLSDIR =
ECHO = $(TOOLSDIR)echo -e
$(TOOLSDIR)是工具的目录,这个make文件可以检测编译环境,如果linux或者有CYGWIN:
$(TOOLSDIR)为空,如果是windows,会转到WIN32版本的echo工具目录,如:
TOOLSDIR = $(subst /,\,$(MAKEDIR)/tools/WIN32/)
我们执行make后,ubuntu会输出:
致命错误:L3900U:无法识别的选项“-e”。
然而,openSUSE 没有这个错误
+++++为 echo -e 更新
我在ubuntu中写了一个测试makefile
all:
echo -e hello
输出:
echo -e hello
你好
+++++更新 openSUE (12.1) 和 ubuntu (12.04) 中的 makefile 测试
all:
echo -e "hello 1"
echo -e hello 2
echo -e he\nllo3
echo -e "he\nllo4"
- opensuse,输出为:
echo -e "你好 1"
你好 1
echo -e hello 2
你好 2
echo -e he\nllo3
henllo3
echo -e "he\nllo4"
他
llo4
- 在 ubuntu 中,输出为:
echo -e "你好 1"
-e 你好 1
echo -e hello 2
你好 2
echo -e he\nllo3
henllo3
echo -e "he\nllo4"
-他
llo4
同时,我在ubuntu中测试,没有-e的回显,结果和openSUSE一样,回显-e
【问题讨论】:
-
你能粘贴上下文的确切错误吗?
echo在ubuntu中支持-e,肯定是别的东西。 -
你们都使用同一个shell解释器吗?重击/嘘?
-
请尝试最小的 makefile:
all:<cr><tab>echo -e hello并告诉我们结果。 -
@Diego Basch,我为你更新了我的错误上下文
-
@Beta,我为你发布了我的测试生成文件