Feedback

Chat Icon

Learn Git in a Day

Everything you need, nothing you don't

How to Use This Guide
7%

Heredoc

In this guide, we'll make extensive use of heredoc to create files. Heredoc is a way to create multi-line strings in Bash. It's a redirection method that allows you to pass multiple lines of input to a command. Here is an example:

cat <file.txt
Passwords are like underwear:
- You shouldn’t leave them out where people can see them.
- You should change them regularly.
- You shouldn’t loan them out to strangers.
EOF

<is the heredoc delimiter. The heredoc ends when the delimiter is encountered at the beginning of a line. The > operator redirects the output to a file. As a result, when you copy and paste the whole block into your terminal, it'll create a file named file.txt with the content:

Passwords are like underwear:
- You shouldnt leave them out where people can see them.
- You should change them regularly.
- You shouldnt

Learn Git in a Day

Everything you need, nothing you don't

Enroll now to unlock all content and receive all future updates for free.

Unlock now  $9.99$7.49

Hurry! This limited time offer ends in:

To redeem this offer, copy the coupon code below and apply it at checkout:

Learn More