From 361f731f883bded516e9038207f306572dd08347 Mon Sep 17 00:00:00 2001 From: Todd Bluhm Date: Mon, 10 Feb 2020 20:00:47 -0600 Subject: [PATCH] docs(readme): update variable expansion docs --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4d6b04f..e8a81cf 100644 --- a/README.md +++ b/README.md @@ -146,13 +146,25 @@ commands together that share the same environment variables. EnvCmd supports expanding `$var` values passed in as arguments to the command. The allows a user to provide arguments to a command that are based on environment variable values at runtime. +**NOTE:** You must escape the `$` character with `\` or your terminal might try to auto expand it before passing it to `env-cmd`. + **Terminal** ```sh -# $USER will be expanded into the env value it contains at runtime -./node_modules/.bin/env-cmd -x node index.js --user=$USER +# $VAR will be expanded into the env value it contains at runtime +./node_modules/.bin/env-cmd -x node index.js --arg=\$VAR ``` +or in `package.json` (use `\\` to insert a literal backslash) +```json +{ + "script": { + "start": "env-cmd -x node index.js --arg=\\$VAR" + } +} +``` + + ### `--silent` suppresses env-cmd errors EnvCmd supports the `--silent` flag the suppresses all errors generated by `env-cmd`