Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
c31d071e
Commit
c31d071e
authored
Sep 07, 2020
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: Document more heredoc pitfalls
parent
9d8cfbee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
varnish-cli.rst
doc/sphinx/reference/varnish-cli.rst
+51
-0
No files found.
doc/sphinx/reference/varnish-cli.rst
View file @
c31d071e
...
...
@@ -134,6 +134,20 @@ can be loaded::
200 14
VCL compiled.
A big difference with a shell here document is the handling of the ``<<``
token. Just like command names can be quoted, the here document token keeps
its meaning, even quoted::
vcl.inline test "<<" EOF
vcl 4.0;
backend be {
.host = "localhost";
}
EOF
200 14
VCL compiled.
When using a front-end to the Varnish-CLI like ``varnishadm``, one must
take into account the double expansion happening. First in the shell
launching the ``varnishadm`` command and then in the Varnish CLI itself.
...
...
@@ -166,6 +180,43 @@ multi-line argument::
EOF'
VCL compiled.
Another difference with a shell here document is that only one here document
can be used on a single command line. For example, it is possible to do this
in a shell script::
#!/bin/sh
cat << EOF1 ; cat << EOF2
hello
EOF1
world
EOF2
The expected output is::
hello
world
With the Varnish CLI, only the last parameter may use the here document form,
which greatly restricts the number of commands that can effectively use them.
Trying to use multiple here documents only takes the last one into account.
For example::
command argument << EOF1 << EOF2
heredoc1
EOF1
heredoc2
EOF2
This conceptually results in the following command line:
- ``"command"``
- ``"argument"``
- ``"<<"``
- ``"EOF1"``
- ``"heredoc1\nEOF1\nheredoc2\n"``
Other pitfalls include variable expansion of the shell invoking ``varnishadm``
but this is not directly related to the Varnish CLI. If you get the quoting
right you should be fine even with complex commands.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment