mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-06 13:25:42 +00:00
Fixed load from another file tip
This commit is contained in:
parent
ab1855e30d
commit
05ee6a44cf
@ -44,13 +44,7 @@ edit
|
|||||||
|
|
||||||
## Set contents from another file
|
## Set contents from another file
|
||||||
|
|
||||||
Use an environment variable with the `strenv` operator to inject the contents from an environment variable.
|
Use the [load](https://mikefarah.gitbook.io/yq/operators/load) operator to load contents from another file.
|
||||||
|
|
||||||
```bash
|
|
||||||
LICENSE=$(cat LICENSE) yq -n '.a = strenv(LICENSE)'
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that `bash` substitution "$(..)" trims newlines, this will cause string blocks to start with `|-` instead of `|`. If you want to keep your nice trailing newline, read more [here](https://mikefarah.gitbook.io/yq/operators/string-operators#string-blocks-bash-and-newlines)
|
|
||||||
|
|
||||||
|
|
||||||
## Special characters in strings
|
## Special characters in strings
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user