Multiline Bash

This is so simple, yet so easily forgotten

$ echo ‘this is a test of the emergency
> backslash multiline
> prompt system.
> When will it end, I dont know for sure
> how about if i close the string’

this is a test of the emergency
backslash multiline
prompt system.
When will it end, I dont know for sure
how about if i close the string

So in your sh scripts, can end each line with a sole backslash, for your command to wrap to the next line (and make your scripts easier to read).

Apparently, env variable PS2 will define what the > prompt appears as.

References: http://ubuntuforums.org/showthread.php?t=1062297

Leave a Reply