4 ms·
Getting a Bourne shell “here document” into a shell variable
- JNRowe 4y agoA discussion¹ of an earlier related post² from the same author brings up a lot of the — sometimes subtle — problems with relying on here documents/strings in shell scripts. ¹ https://news.ycombinator.com/item?id=29845232 https://news.ycombinator.com/item?id=29845232 ² https://utcc.utoronto.ca/~cks/space/blog/unix/ProcessSubstitutionWhyLate https://utcc.utoronto.ca/~cks/space/blog/unix/ProcessSubstit...
- kstenerud 4y agoOnce I found myself doing this, I switched to Python and never looked back.
- oweiler 4y agoJust use read with a heredoc. read is a Bash builtin so no process needs to be forked. https://github.com/helpermethod/up/blob/master/src/.bash_functions#L16 https://github.com/helpermethod/up/blob/master/src/.bash_fun...