On Tue, Dec 18, 2012 at 6:32 AM, Marc Espie <[email protected]> wrote: > On Tue, Dec 18, 2012 at 11:47:59AM +0100, Alexander Hall wrote: >> >> >> Andres Perera <[email protected]> wrote: >> >> >On Mon, Dec 17, 2012 at 7:07 PM, Alexander Hall <[email protected]> >> >wrote: >> >> >> >> For scripting, echo is one of the commands I tend to avoid unless I >> >know the >> >> data is "safe", because of it's horrific argument parsing. >> >> >> >> I've yet to find a way to echo a single '-n' using the sh/ksh >> >builtin. When >> >> printing unknown data, I usually end up using 'print -r -- "$var"' >> >(or >> >> 'printf "%s" "$var"' if I care about portability). >> >> >> >> /Alexander >> >> >> > >> >the worrysome part is what happens with make: >> > >> >andres@pote:~ $ echo '/nonexsistent:;@echo -e hello' | make -f- | vis >> >-e hello\$ >> >andres@pote:~ $ echo '/nonexsistent:;@echo -e hello;' | make -f- | vis >> >hello\$ >> > >> >this is due to the optimization to fork+exec instead of shell when >> >there are no meta characters. the second makefile has `;', so the >> >optimization doesn't get triggered >> > >> >what is the problem? 2 echos that disagree or the optimization itself? >> >are the calls coming from *INSIDE* the house? >> >> I don't think make should optimize this, but recognize echo as a shell >> builtin. > Is this theoretical, or is there an actual Makefile where this is a problem ? > > I'd rather NOT go through extra shell forking just for the sake of it. > > Also, echo -e is specific to ksh and NOT a posix option, so you're going > to end up with something that is deeply non-portable. > > Either way, this is fucked up. >
i believe it is theoretical because i can't find a way to embed a backslash without skipping the optimization. using `-e' without backslashes would be pointless i still think both echos should agree out of principle, even though them agreeing isn't immediately useful the make optimization is perfectly valid, and other makes do something similar

