4

This question already has an answer here:

What are the operators <<and < used for in Linux?

For example

cat << abc.txt

marked as duplicate by don_crissti, G-Man, cuonglm, Stephen Kitt, Archemar Aug 3 '15 at 8:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

6

< is used to redirect input. Saying

command < file

executes command with file as input.

The << syntax is referred to as a here document. The string following << is a delimiter indicating the start and end of the here document.

$ cat abc.txt
cat: abc.txt: No such file or directory
$ cat << abc.txt
> Hello!
> Hey :)
> abc.txt
Hello!
Hey :)
$

<< doesn't indicate any sort of indirection.


You might also want to refer to redirection and here document.

  • I personnaly still don't understand – Kiwy Feb 10 '14 at 8:54
  • @Kiwy What is it that you don't understand? – devnull Feb 10 '14 at 8:55
  • Well reading it third time I start to understand you should express it as a end of input delimiter instead it would be way more clear than writing some script and explaining after. – Kiwy Feb 10 '14 at 8:57
  • @devnull : so, << will act as input if i say grep "somestring" << filename.txt ...just asking to clear out my head on this!! – NoobEditor Feb 10 '14 at 8:58
  • 1
    @NoobEditor You might want to refer to a couple of links added in the answer. – devnull Feb 10 '14 at 9:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.