Line Continuation

Line continuation is the capability to have a command span more than one line. Two ways of causing a line continuation are available. The first was done accidentally earlier in the chapter; this method is not recommended. It is done by not closing a quote:

$ echo 'hell
> o world
> this
> is line
> continuation the
> non-
> recommended
> way!'
hell
o world
this
is line
continuation the
non-
recommended
way!

This happens because the newline character loses its specialness within the single quotes. This means that instead of signifying that the user is ready to submit a command for processing, the user wants to have the new line as part of the string. Here's the other method:

 $ echo Hell\ > o world \ > this \ > is line \ > continuation ...

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.