Skip to main content
10 events
when toggle format what by license comment
Feb 27, 2023 at 23:36 comment added kbulgrien Use of 'read -r' breaks compatibility with some very old systems (i.e. SCO OpenServer 5.0.7). On that system, I had to use a slightly modified copy of the POSIX variant posted by @user232326 (I moved the here document outside the function).
Jan 29, 2017 at 7:56 history edited Kevin CC BY-SA 3.0
Always end with a newline
Jan 29, 2017 at 7:21 comment added Kevin @sorontar That makes sense, thanks for the references!
Jan 29, 2017 at 7:08 comment added user232326 3.206 Line A sequence of zero or more non- <newline> characters plus a terminating <newline> character.
Jan 29, 2017 at 7:07 comment added user232326 3.195 Incomplete Line A sequence of one or more non- <newline> characters at the end of the file.
Jan 29, 2017 at 7:04 comment added user232326 Yes, A here-document must end with a newline, and you code remove it. Every "text line must end on a newline". Search in definitions of text file.
Jan 29, 2017 at 6:53 comment added Kevin @sorontar Interesting point about the trailing newline. A here-document must end with a newline, followed by the delimiter and a newline, but it doesn't say whether the newline before the delimeter should be part of the string or not: pubs.opengroup.org/onlinepubs/9699919799/utilities/…
Jan 29, 2017 at 6:35 comment added Kevin @sorontar I just tested it and the trailing new line didn't seem erased to me. I'm not sure what you mean by the first point about using a variable to read the first line. Regarding the eval, it's only used for the name of the "output" variable. If we assume trusted users of the function, are there any other issues using eval in this example?
Jan 29, 2017 at 5:00 history edited Kevin CC BY-SA 3.0
Remove use of unnecessary variable
Jan 29, 2017 at 4:44 history answered Kevin CC BY-SA 3.0