Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Indeed this works, but requires a file to be fed to the while-loop. My actual code is more complex, and requires a modified multiline string to be fed to the while-loop. Your solution to write this multiline string to a temporary file works, but is there a solution that does not require writing a temporary file? Commented Mar 31, 2019 at 11:28
  • @Steiner See update answer. There's not much else you could do without using features of specific shells. Commented Mar 31, 2019 at 11:33
  • Thank you that answers my question. The suggestion at the end and the links provided are very helpful too! Commented Mar 31, 2019 at 11:43
  • @Steiner ... except for using a here-document. Well, there's a thing I didn't think of :-) Commented Mar 31, 2019 at 18:42