Timeline for How to set a value with newline by `env` command?
Current License: CC BY-SA 4.0
2 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 15, 2021 at 5:10 | comment | added | Stéphane Chazelas | +1 beware though that with env FOO="$(printf "%b" 'hello\nworld\n\n\n')", all the trailing newline characters would be removed by the command substitution. bash and zsh support printf -v tmp %b "$string_with_escapes"; env FOO="$tmp" ... but in zsh, you'd rather use env FOO=${(g::)string ... (echo-style, though \c not handled) or ${(g:o:)string} (C/usual-style) | |
| Oct 14, 2021 at 20:50 | history | answered | Toby Speight | CC BY-SA 4.0 |