3 ms·
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 "
by AceJohnny2 14y ago
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 http://en.wikipedia.org/wiki/Here_document
For extra credit, try using a "Here Document" as input for 'echo' and 'cat'. Explain the results.
- allstruck 14y agoWhat 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.
- akldfgj 14y ago`man bash` , search for "<<" see the "Here Strings" section. You can also search https://www.google.com/search?q=bash 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