Bash: sh* also captures output not ending with \n.
authorChris McCormick <chris@mccormick.cx>
Sun, 1 Dec 2019 06:23:08 +0000 (14:23 +0800)
committerChris McCormick <chris@mccormick.cx>
Sun, 1 Dec 2019 06:23:08 +0000 (14:23 +0800)
bash/stepA_mal.sh

index 1467a74..2c4de6d 100755 (executable)
@@ -165,8 +165,8 @@ EVAL () {
         sh__STAR__)  EVAL "${a1}" "${env}"
               local output=""
               local line=""
-              while read line; do
-                  output="${output}${line}"$'\n'
+              while read -r line || [ -n "${line}" ]; do
+                output="${output}${line}"$'\n'
               done < <(eval ${ANON["${r}"]})
               _string "${output%$'\n'}"
               return ;;