Hello world/Newline omission: Difference between revisions

Line 234:
<lang bash>printf "Goodbye, World!" # This works. There is no newline.
printf %s "-hyphens and % signs" # Use %s with arbitrary strings.</lang>
 
Unfortunately, older systems where you have to rely on vanilla Bourne shell may not have a ''printf'' command, either. It's possible that there is no command available to complete the task, but only on very old systems. For the rest, one of these two should work:
 
<lang bash>echo -n 'Goodbye, World!'</lang>
or
<lang bash>echo 'Goodbye, World!\c'</lang>
 
The ''print'' command, from the [[Korn Shell]], would work well, but most shells have no ''print'' command. (With [[pdksh]], ''print'' is slightly faster than ''printf'' because ''print'' runs a built-in command, but ''printf'' forks an external command. With [[ksh93]] and [[zsh]], ''print'' and ''printf'' are both built-in commands.)
1,481

edits