On Wed, Mar 14, 2018 at 06:45:15PM -0700, L A Walsh wrote: > Is relying on HERE-doc implementation something that is portable? Is it > required by POSIX? Still a few things to remember...
POSIX says "no": It is unspecified whether the file descriptor is opened as a regular file, a special file, or a pipe. Portable applications cannot rely on the file descriptor being seekable (see XSH lseek). http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04 That said, I think a lot of scripts *do* bend this rule and rely on the here-document creating a seekable temp file, because this has been the common practice across many different shells for a long time.