From a532b60c7eafc646052ee053c3870f00a7556f9a Mon Sep 17 00:00:00 2001 From: Jake Utley Date: Fri, 1 Mar 2019 14:04:48 -0800 Subject: [PATCH] etcdctl: Update README to clarify newline syntax in TXN Add documentation to clarify that when writing TXN commands, multi-line values should be written using "\n" and not a literal newline (as in other commands). Fixes #10169 --- etcdctl/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/etcdctl/README.md b/etcdctl/README.md index 0ac943aa322..f4d1f08f031 100644 --- a/etcdctl/README.md +++ b/etcdctl/README.md @@ -329,6 +329,27 @@ put key2 "some extra key" # OK ``` +#### Remarks + +When using multi-line values within a TXN command, newlines must be represented as `\n`. Literal newlines will cause parsing failures. This differs from other commands (such as PUT) where the shell will convert literal newlines for us. For example: + +```bash +./etcdctl txn <<<'mod("key1") > "0" + +put key1 "overwrote-key1" + +put key1 "created-key1" +put key2 "this is\na multi-line\nvalue" + +' + +# FAILURE + +# OK + +# OK +``` + ### COMPACTION [options] \ COMPACTION discards all etcd event history prior to a given revision. Since etcd uses a multiversion concurrency control