21

What's the difference between "echo" and "@echo" in the unix world?

I can't even google special characters.

For example, as used here

Mako
  • 271
  • 1
  • 3
  • 8

2 Answers2

38

That's a Makefile-specific thing; it has nothing to do with shell scripts.

Recipes that begin with @ do not echo the command. That is to say, with a 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

foo:
    @echo foo

it is

$ make foo
foo
Wintermute
  • 42,983
  • 5
  • 77
  • 80
  • There's [SymbolHound](http://symbolhound.com/), although it's been hit-and-miss for me. Apart from that: you should be able to accept the answer in a few minutes. There's a delay to make it more difficult for bots to generate each other lots of reputation (at least I think that's the reason). – Wintermute Apr 11 '15 at 10:39
  • which is why you really dont need "make". the shell is sufficient, _and_ you ONLY have one tools syntax to deal with. e.g. "newest foo /dev/null || echo foo". I'll post "newest" below. – Marty McGowan Apr 12 '15 at 01:26
  • @Mako google queries in "quotes" should search for that exact string,, also see [Google Advanced Search](https://www.google.com/advanced_search) – yano Oct 10 '18 at 20:29
  • I found this answer with "@echo" linux via DuckDuckGo. :-) – Fiddy Bux Dec 04 '18 at 21:08
-1
applemcg.$ fbdy newest trace_any
function newest
{ 
    trace_call $# $*;
    [[ -f "$1" ]] || { 
        trace_call NO $1;
        return 1
    };
    t=$1;
    shift;
    while [[ -n "$1" ]]; do
        [[ "$t" -ot "$1" ]] && { 
            trace_call NEWER $1 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.

Marty McGowan
  • 356
  • 2
  • 10