Bash - Here Documents

Bash Liste Des Attaques Ovh


Language - Here Document in Bash.

Here document in Bash is implemented through redirection. A redirection instructs the shell to read input from the current source until a line containing only word (with no trailing blanks) is seen. All of the lines read up to that point are then used as the standard input for a command.


FirstWorldDelimiter not quoted


cat <<-HereDoc

   my Variable is $foo
my Variable is foo

FirstWorldDelimiter quoted


cat <<-"HereDoc"

   my Variable is $foo
my Variable is $foo


The format of here-documents is:



  • « is the redirection operator
  • - (optional) is used then all leading tab characters are stripped from input lines and the line containing delimiter. This allows here-documents within shell scripts to be indented in a natural fashion.
  • wordDelimiter and wordDelimiter delimit the content of the here-document

Bash variant: The word is expanded and supplied to the command on its standard input.

<<< word

first WordDelimiter


is performed on the first WordDelimiter.


If the first wordDelimiter is:

In the latter case, the character sequence \<newline> is ignored, and \ must be used to quote the characters \, $, and .

second WorldDelimiter

The second WorldDelimiter is generally the result of quote removal on the first WordDelimiter.

Discover More
Bash Liste Des Attaques Ovh
Bash - Standard input (stdin)

operations that applied only to the bash|bash shell See The input redirection operator takes the content of a file and send it as standard input Example with read that take a stand Create...
Bash Liste Des Attaques Ovh
Bash - Template

Template functionality with bash. with here_document See envsubst
Bash Liste Des Attaques Ovh
What are Redirections in Bash? Example and how-to

This article talks shell redirections in the Bash shell. Through redirection you can direct the input and output of a command to and from other files and programs, and chain commands together in a pipeline....
Yaml Representation
Yaml - Scalar

There are 5 styles of scalars in YAML: plain, - A plain scalar does not use indicators to denote its start and end single-quoted, - to express any value that does not contain special characters...

Share this page:
Follow us:
Task Runner