summaryrefslogtreecommitdiffstats
path: root/eshtrans
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-28 00:42:31 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-28 00:42:31 (EST)
commit18ace1fbd610396467a41927d12c5b2ce6511b66 (patch)
tree42f115baf8316bab6f04bb0702caa9164b41e7ef /eshtrans
parentf7814a37b5bfa1f51cba8c7fd554d53b48dd668b (diff)
downloadeggshell-18ace1fbd610396467a41927d12c5b2ce6511b66.zip
eggshell-18ace1fbd610396467a41927d12c5b2ce6511b66.tar.gz
eggshell-18ace1fbd610396467a41927d12c5b2ce6511b66.tar.bz2
eshtrans: Preserve trailing whitespace in input files
Diffstat (limited to 'eshtrans')
-rw-r--r--eshtrans/main.esh10
1 files changed, 7 insertions, 3 deletions
diff --git a/eshtrans/main.esh b/eshtrans/main.esh
index 588ca1d..ac3895e 100644
--- a/eshtrans/main.esh
+++ b/eshtrans/main.esh
@@ -88,10 +88,14 @@ main()
fi
input="${1}"
if [ "x${output}" = 'x-' ]; then
- sh_codegen "$(esh_parse "${input}" "$(cat "${input}")")"
+ contents="$(cat "${input}"; printf '.')"
+ contents="${contents%.}"
+ sh_codegen "$(esh_parse "${input}" "${contents}")"
else
- sh_codegen "$(esh_parse "${input}" \
- "$(cat "${input}")")" >"${output}"
+ contents="$(cat "${input}"; printf '.')"
+ contents="${contents%.}"
+ sh_codegen "$(esh_parse "${input}" "${contents}")" \
+ >"${output}"
fi
fi
}