Section 6.6. Redirection


[Page 221 (continued)]

6.6. Redirection

Bash supplies an additional redirection capability over the standard shell redirection, the ability to strip leading tabs off of "here" documents. Figure 6-22 shows the augmented syntax.

Figure 6-22. Redirection with a "here" document in Bash.

command << [-] word



[Page 222]

If word is preceded by a -, then leading tabs are removed from the lines of input that follow. Here's an example:

$ cat <<- ENDOFTEXT >           this input contains >     some leading tabs >ENDOFTEXT this input contains some leading tabs $ _ 


This allows "here" text in a script to be indented to match the nearby shell commands without affecting how the text is used.




Linux for Programmers and Users
Linux for Programmers and Users
ISBN: 0131857487
EAN: 2147483647
Year: 2007
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net