相关疑难解决方法(0)

ubuntu中的echo -e选项不起作用

我的同事使用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)
  1. opensuse,输出是:

echo -e"你好1"

你好1

echo -e你好2

你好2

echo -e he \nllo3

henllo3

echo -e"he \nllo4"

llo4

  1. 在ubuntu中,输出是:

echo -e"你好1"

你好1

echo -e你好2

你好2 …

shell ubuntu makefile

5
推荐指数
1
解决办法
3962
查看次数

标签 统计

makefile ×1

shell ×1

ubuntu ×1