What does the double less than sign (<<) means in creating a new file with cat?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
The input redirector << means use the current input stream as STDIN for the program until token is seen where token can be anything. Basically you'll get a prompt > where you can type in your commands or whatever until token (END, WHATEVER) is encountered on a new line.
Last edited by EricTRA; 08-25-2010 at 03:13 AM.
Reason: Added more info
A limit string delineates (frames) the command list. The special symbol << designates the limit string....
# 'echo' is fine for printing single line messages,
#+ but somewhat problematic for for message blocks.
# A 'cat' here document overcomes this limitation.
This is line 1 of the message.
This is line 2 of the message.
This is line 3 of the message.
This is line 4 of the message.
This is the last line of the message.
Thanks guys for the replies.
But strange things happens:
$cat > any.sh << EOF
any variable is expanded (e.g., if I type $USER in, and later I cat any.sh, the var is expanded to its value).
But if I do not use '<<', just cat to a file and save it by ^D, variables are not expanded...