Hi Ola and James, On Mon, Dec 28, 2009 at 7:30 PM, Ola Lundqvist <o...@debian.org> wrote: > When it comes to the echo versus printf I have tested both the > original printf solution, your suggestion and the echo solution. > > As no options are needed to echo there are no compatibility issues in using > echo. That is the reason why I'd vote for that one. However I will > file a bug against upstream about this and let them decide the solution. > > In the meantime I will patch it to use echo. Otherwise it is very hard > to determine the error both with bash and dash as it is currently not printed.
A couple of years ago I've had to write a script that should be executed in any *nix environment, my test cases were Debian, RHEL and Solaris. That's how I've learned that "echo" cannot be used for printing messages because not all shells accepts the "-en" arguments. Not even on Debian Linux bash and dash will have the same behaviour. Instead, since then I'm using "printf" without any portability problem. The only reliable call for "echo" is as you said without any arguments (it will print a new line too after the strings). In conclussion, I'm strongly recommending to use "printf". But keep in mind that printf accepts only one or two strings (example "%s %s" "$VAR1 $VAR2") -- printf = print with format. Thanks ------ d...@frost:~$ dash $ echo -en "ok\n" -en ok $ echo -n "ok" ok$ $ $ echo "ok" ok $ echo -e "ok\n" -e ok $ printf "ok\n" ok $ ps ax | grep $$ 984 pts/0 S 0:00 dash -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org