Commit c176b2b
README.md
@@ -186,7 +186,7 @@ Specifies verbosity. Default: `true`.
In verbose mode prints executed commands with outputs of it. Same as
`set -x` in bash.
-### Importing
+### Importing from other scripts
It's possible to use `$` and others with explicit import.
@@ -196,6 +196,13 @@ import {$} from 'zx'
await $`date`
```
+### Passing env variables
+
+```js
+process.env.FOO = 'bar'
+await $`echo $FOO`
+```
+
### Executing remote scripts
If arg to `zx` bin starts with `https://`, it will be downloaded and executed.
test.mjs
@@ -68,3 +68,8 @@ function assert(cond, msg) {
}
assert(p.exitCode === 1)
}
+
+{
+ process.env.FOO = 'hi; exit 1'
+ await $`echo $FOO`
+}