Difference between echo and print in the Korn shell
5,966
III. SHELL PROGRAMMING QUESTIONS
[...]
Q12. Why does [ksh] have print since echo already exists [and] is widely used?A12. The behavior of echo varies from system to system. The POSIX standard does not define the behavior of echo when the first argument beings with a - or when any argument contains a \ character. This makes echo pretty useless for use in portable scripts.
http://kornshell.com/doc/faq.html
Related videos on Youtube
Author by
trudgemank
Updated on September 18, 2022Comments
-
trudgemank almost 2 years
In Ksh,
echo hello world
andprint hello world
will return the same output (hello world). What is the difference between these text processing commands with respect to the Korn Shell?I know how they work in BaSH, Cshell, and tcsh.
-
Admin over 7 yearssee also: unix.stackexchange.com/questions/65803/…
-
Admin over 7 yearsI saw that when I googled this question :)
-
-
Stéphane Chazelas over 7 yearsNote that ksh's
print
predates theprintf
command. -
trudgemank over 7 yearsSo basically what you're saying is they're the same?
-
trudgemank over 7 yearsFor the korn shell
-
trudgemank over 7 yearsand by that logic (no portability) isn't print useless too? :/ It's use with tcsh csh and bash is completely different than with ksh which more resembles PRINT in BASIC than UNIX imo.