有无@在echo前面这个要分情况来说明,如果是写在Makefile里面:
@echo
这样不会回写命令行,什么意思呢,就是直接显示echo输出的内容.
在上一篇介绍go Makefile时,有下面这样一段:
.PHONY: clean test
test:
@echo "testing..."
go test github.com/user/stringutil
@echo "test Done!"
执行后是:
jack@jxes-VirtualBox:~/gopath$ make test
testing...
go test github.com/user/stringutil
ok github.com/user/stringutil 0.011s
test Done!
echo
在Makefile中没有@就会回显命令行内容,将上面栗子中的@去掉后的情形如下:
.PHONY: clean test
test:
echo "testing..."
go test github.com/user/stringutil
echo "test Done!"
执行后是:
jack@jxes-VirtualBox:~/gopath$ make test
echo "testing..."
testing...
go test github.com/user/stringutil
ok github.com/user/stringutil 0.009s
echo "test Done!"
test Done!
最后说下,在shell下面,是没有@echo这种写法的。