Pete's Linux Advent Calendar 2007

The 4th day

Vertical scripting

Scripts are text files, and in text files you can grep for strings. But you can prevent finding certain commands or strings by splitting them across lines using the backslash. This of course can make your script hard to read. The following script will print "Hello, world!" to stdout:
#!/bin/bash
e\
c\
h\
o\
 \
H\
e\
l\
l\
o\
,\
 \
w\
o\
r\
l\
d\
!
I am sure you can find other usages of this feature.
Pete's Linux Advent Calendar 2007

Valid HTML 4.01!

Comments? send mail to pkruse@arcor.de my monogram