Skip to content

Commit 2c69559

Browse files
authored
Merge pull request #10513 from jutley/txn-newline-documentation
etcdctl: Update README to clarify newline syntax in TXN
2 parents a943ad0 + a532b60 commit 2c69559

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: etcdctl/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,27 @@ put key2 "some extra key"
329329
# OK
330330
```
331331

332+
#### Remarks
333+
334+
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:
335+
336+
```bash
337+
./etcdctl txn <<<'mod("key1") > "0"
338+
339+
put key1 "overwrote-key1"
340+
341+
put key1 "created-key1"
342+
put key2 "this is\na multi-line\nvalue"
343+
344+
'
345+
346+
# FAILURE
347+
348+
# OK
349+
350+
# OK
351+
```
352+
332353
### COMPACTION [options] \<revision\>
333354

334355
COMPACTION discards all etcd event history prior to a given revision. Since etcd uses a multiversion concurrency control

0 commit comments

Comments
 (0)