我的同事使用Ubuntu并且我使用openSUSE,我们使用相同的makefile编译相同的源代码,我的环境运行良好,但我的同事不能,总是输出无法识别的-e选项.我们检查makefile,只查找echo命令使用-e选项.
剂量Ubuntu的回声功能与其他功能不同?
在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
Run Code Online (Sandbox Code Playgroud)
它输出:
echo -e你好
你好
++++更新makefile测试在openSUE(12.1)和ubuntu(12.04)
all:
echo -e "hello 1"
echo -e hello 2
echo -e he\nllo3
echo -e "he\nllo4"
Run Code Online (Sandbox Code Playgroud)
echo -e"你好1"
你好1
echo -e你好2
你好2
echo -e he \nllo3
henllo3
echo -e"he \nllo4"
他
llo4
echo -e"你好1"
你好1
echo -e你好2
你好2 …