From 77e255ad6bd27b41b61822b2a0e8105b782a9582 Mon Sep 17 00:00:00 2001 From: KirtiRamchandani Date: Mon, 1 Jun 2026 22:33:54 +0530 Subject: [PATCH] docs: clarify multiline command continuations --- docs/getting-started.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/getting-started.md b/docs/getting-started.md index bfce936a07..a5758e335b 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -99,6 +99,18 @@ const flags = [ await $`git log ${flags}` ``` +For a long command, use the shell's line-continuation syntax. Keep the +backslash as the final character on each continued line; trailing spaces after +the backslash make the shell treat the next line as a separate command. + +```js +const preview = 'cat {2}' + +await $`fzf \ + --preview=${preview} \ + --with-nth=1` +``` + In async mode, zx awaits any `thenable` in literal before executing the command. ```js const a1 = $`echo foo`