Hi Teodor

Thanks a lot for this information.

Best regards,

// Ola

On Tue, Dec 29, 2009 at 12:24:06AM +0200, Teodor MICU wrote:
> Hi Ola and James,
> 
> On Mon, Dec 28, 2009 at 7:30 PM, Ola Lundqvist <[email protected]> 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
> 

-- 
 --- Inguza Technology AB --- MSc in Information Technology ----
/  [email protected]                    Annebergsslingan 37        \
|  [email protected]                   654 65 KARLSTAD            |
|  http://inguza.com/                Mobile: +46 (0)70-332 1551 |
\  gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9  /
 ---------------------------------------------------------------



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to