Skip to main content
8 events
when toggle format what by license comment
Feb 27, 2023 at 23:31 comment added kbulgrien The HEREDOC embedded in the POSIX labelled version seems like a typo. Why would it make any sense to embed the here document in the function? I tested a modified copy on the POSIX version that did not not embed the here document but assigned the variable more like the other examples did, and the update works on a very old Bourne shell from SCO OpenServer 5.0.7. I don't see any reason for the \HEREDOC, but maybe there is more to this that I do not understand.
Dec 29, 2020 at 22:22 comment added saulius2 That backslash in the<<\HEREDOC ! Thanks a million.
Feb 23, 2017 at 22:20 history edited user232326 CC BY-SA 3.0
Added a solution that better fits the OP expected code flow.
Feb 23, 2017 at 18:42 history edited user232326 CC BY-SA 3.0
Updated compatible shells list.
Jan 29, 2017 at 6:33 history edited user232326 CC BY-SA 3.0
Added a missing nl variable.
Jan 29, 2017 at 6:11 history edited user232326 CC BY-SA 3.0
Correct trailing new line.
Jan 29, 2017 at 5:57 history edited user232326 CC BY-SA 3.0
Added a POSIX solution.
Jan 29, 2017 at 2:39 history answered user232326 CC BY-SA 3.0