6

In Ksh, echo hello world and print 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.

6

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

  • 3
    Note that ksh's print predates the printf command. – Stéphane Chazelas Nov 21 '16 at 14:19
  • So basically what you're saying is they're the same? – trudgemank Nov 21 '16 at 18:24
  • For the korn shell – trudgemank Nov 21 '16 at 18:24
  • and 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. – trudgemank Nov 21 '16 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.