pavement

Escaped to multi-line format

From FreeBSDwiki
Revision as of 13:14, 5 May 2007 by Jimbo (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

An often-followed convention when reproducing shell scripts online is escaping carriage returns, using the backslash character, in order to render single very long continous lines into multiple lines for readability. For example, the following simple script, which concatenates a lot of files into one file named "all.files":

#!/bin/sh

cat one.file two.file three.file four.file five.file six.file seven.file eight.file > all.files

Could be rendered like this:

#!/bin/sh

cat one.file two.file three.file \
four.file five.file six.file \
seven.file eight.file \
> all.files

Be aware that in some rare cases (in particular, I have seen this occur in Makefiles) there may be problems associated with escaping long lines - so if you're having strange inexplicable issues with a script not working right that has multi-line escapes in it, you might want to try returning any multi-lines to standard format to see if that fixes the problem.

Personal tools