<< operator

created by Baron_Saturday
(thing) by Baron_Saturday (7 y) (print)   ?   (I like it!) Wed Dec 06 2000 at 6:24:03
A form or redirection used in shell scripts. The << operator is followed by a character string, and until that character string is repeated everything in the file is treated as if it was being typed in on stdin

For example:
#!/bin/sh
mail bob@domain.com << END
The mail program will act as if I 
typed this with the keyboard after 
running the command 
'mail bob@domain.com'
END
(idea) by Nanosecond (10.2 mon) (print)   ?   (I like it!) Tue Jan 30 2001 at 4:39:26

The bitwise operator in C/C++ that shifts bits to the left. Shifting the bits of an integer to the left is equivalent to multiplying by powers of 2. For example:

x << y == x * 2y

(thing) by rp (3.9 wk) (print)   ?   (I like it!) Mon Mar 19 2001 at 1:38:42
The input specified in the here document construct described by Baron_Saturday is treated as a double-quoted string: variables are expanded. So the (Bourne shell) sequence


hi=hello
echo $hi | mail `whoami`
mail `whoami` <<ZZ
$hi
ZZ

will actually give you two identical mail messages, with a body of hello.

Perl has this, too, and adds a variant that takes the input literally.

Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.