Skip to content

Commit

Permalink
Add redirection example to README
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-allan committed Aug 30, 2021
1 parent f70eae2 commit 743b412
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ You can also download binaries for unreleased versions from the [latest successf

# Usage

The `envtpl` binary expects input on STDIN and writes to STDOUT. Any template strings of the format `${NAME}` will be replaced with the value of the environment variable matching `NAME`.
The `envtpl` binary expects input on STDIN and writes to STDOUT. Any template strings of the format `${NAME}` will be replaced with the value of the environment variable matching `NAME`. For example:

```sh
$ echo 'Hello ${USER}!' | envtpl
Hello matt!
```

For the typical use case of templating a source file, you can use [redirection](https://wiki.bash-hackers.org/howto/redirection_tutorial):

```
envtpl < nginx.tpl.conf > nginx.conf
```

## Differences from envsubst

- Doesn't replace environment variables that aren't wrapped in curly braces. Avoids issues with variables that aren't meant to be replaced in the same file
Expand Down

0 comments on commit 743b412

Please # to comment.