For some reason i dont remember, i currently believe (but beeing unsure) that printf is available on more diffrent systems (unix, bsd, linux, ??) than echo is.
Could someone please enlighten me, whether this is true or not?
Thank you
PS:
I just found pages about the diffrences of the two commands, but not where they are available or not.
The printf utility has been almost universally available for more than 2 decades and is a built-in in almost all current shells. There is a large set of conversion specifiers that behave the same way on all systems and in all shells. (Some shells provide extensions that supply additional conversion specifiers.)
The echo utility has been universally available for more than 4 decades and is a built-in in almost all current shells. The meaning of various options and backslash escape sequences recognized by echo varies from system to system and shell to shell.
As I have said in dozens of other threads in these forums: if the first character of the first argument is a minus sign, if any argument contains a backslash, if you do not want to have a newline printed at the end of the output, or if any argument contains user-supplied data; use printf , not echo . Otherwise, it doesn't matter whether you use printf or echo .