Website: Delete the unnecessary backslash at the end shell command line

Shell thinks '\<newline>' as line continuation only when it's unquoted
or in double quotes. It's not necessary to manually mark '\<newline>'
in single quotes, because when shell sees the a single quote starts, it
continues the line automatically until it sees the matching single quote
ends.

Thus,
echo 'a\
  b'
would give the following output
a\
  b

And
echo 'a
  b'
gives the following output
a
  b

Since we don't want to leave backslashes in the resulting json files, we
should remove the line continuation backslashes inside single quotes.
This commit is contained in:
Zhou Zheng Sheng 2015-07-07 11:08:22 +08:00
parent 2783f2bfec
commit 85f7064fe0
1 changed files with 2 additions and 2 deletions

View File

@ -30,11 +30,11 @@ Create two definition files in the Consul configuration directory of
the second node:
```text
vagrant@n2:~$ echo '{"check": {"name": "ping", \
vagrant@n2:~$ echo '{"check": {"name": "ping",
"script": "ping -c1 google.com >/dev/null", "interval": "30s"}}' \
>/etc/consul.d/ping.json
vagrant@n2:~$ echo '{"service": {"name": "web", "tags": ["rails"], "port": 80,\
vagrant@n2:~$ echo '{"service": {"name": "web", "tags": ["rails"], "port": 80,
"check": {"script": "curl localhost >/dev/null 2>&1", "interval": "10s"}}}' \
>/etc/consul.d/web.json
```