Re: [PATCH] Use printf rather than echo -n.
- From
Junio C Hamano <junkio@cox.net>
- Date
- Dec 7, 2005, 02:04 UTC
- Message-ID
- <7vfyp5zmqe.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20512.1133907712@lotus.CS.Berkeley.EDU>
Jason Riedy <ejr@EECS.Berkeley.EDU> writes:
Show 7 quoted lines
> On AIX, there is no -n option to the system's echo. Instead, > it needs the '\c' control character. We could replace > echo -n "foo" > with > echo -e "foo\c" > but printf is recommended by most man pages. Tested on AIX > 5.3, Solaris 8, and Debian.
Hmmmmmmmmmmmmmmmmmmmmmmmm.
Perhaps printf '%s' "$blah" to futureproof, instead of just saying printf "$blah"?
<rant mode on> While I do not have anything aginst system without "sane" echo, I really do not like it. Not your solution, but *having to do* something like that.
metaconfig Configure does "echo $n frotz $c" with n=-n or c=\\c set appropriately; autoconf does the same with $ac_n $ac_c. IIRC, I think ancient autoconf did "echo | tr -d '\012'".
These are far worse than a single printf, although they may be more portable.
</rant mode off>
As a traditionalist, if I were doing it myself I would probably pipe echo to tr, but I am lazy so I'd take your patch as is ;-).