bash unix shell 中 echo 和 @echo 的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29576815/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between echo and @echo in unix shells
提问by Mako
回答by Wintermute
That's a Makefile-specific thing; it has nothing to do with shell scripts.
那是Makefile 特有的东西;它与 shell 脚本无关。
Recipes that begin with @
do not echo the command. That is to say, with a Makefile
以 开头的食谱@
不回显该命令。也就是说,用一个Makefile
foo:
echo foo
You get
你得到
$ make foo # <-- this is meant to be the command you enter in the shell
echo foo
foo
Whereas with a Makefile
而使用 Makefile
foo:
@echo foo
it is
这是
$ make foo
foo
回答by Marty McGowan
applemcg.$ fbdy newest trace_any
function newest
{
trace_call $# $*;
[[ -f "" ]] || {
trace_call NO ;
return 1
};
t=;
shift;
while [[ -n "" ]]; do
[[ "$t" -ot "" ]] && {
trace_call NEWER than $t;
return 1
};
shift;
done;
trace_call NEWEST $t;
return 0
}
function trace_any
{
printf $* 1>&2
}
applemcg.$
so, the "make paradigm" is
所以,“制作范式”是
newest outputfile inputa inputb... || {
command input... > outputfile
}
and you cat toss your makefiles on the scrap heap of history.
然后你把你的 makefile 扔到历史的垃圾堆上。