News for hackers. Stuff that matters.
Re:Bash redirections cheat sheet by AceJohnny2 on Monday September 10, 2012 @03:57PM (#4501868)
the "cmd <<EOL ..\n..\n EOL" part has been mystical to me for ages, especially as I didn't know what to google to find out. I recently learned it was called a "Here Document". http://en.wikipedia.org/wiki/Here_document

For extra credit, try using a "Here Document" as input for 'echo' and 'cat'. Explain the results.

Re:Bash redirections cheat sheet by akldfgj on Tuesday September 11, 2012 @11:43PM (#4509028)
`man bash` , search for "<<" see the "Here Strings" section.

You can also search https://www.google.com/search?q=bash and follow links to "Documentation"

    xargs echo <<EOL  
    > line 1
    > line 2  
    > EOL
    line 1 line 2

    $ cat <<EOL
    > line 1
    > line 2 
    > EOL
    line 1
    line 2
line-terminators get eaten by xargs
Re:Bash redirections cheat sheet by allstruck on Monday September 10, 2012 @04:40PM (#4502125)
What is so mystifying about this?

Doing this:

"cat << EOL

line one

line two

EOL"

Would be the same as this:

"cat < file"

That is if 'file' contained this:

"line one

line two"

This doesn't work with the echo command because it does not use stdin like cat does.