Shab always adds a newline to the input file
Alch-Emi opened this issue · 3 comments
Running shab on any input produces the expected output plus one newline at the end of the output. This seems to be due to the way that appending the delimiter (SHAB_$id
) to the output is implemented.
It's possible to bandaid this by passing the output to head -c-1
, although I couldn't find a way to fix this at its root. I can PR the head
fix, although I thought I'd open an issue in case someone can come up with a better solution
Edit: Looking over it, it seems like the first call to cat on line 28 can be replaced with head to do this without additional overhead, although looking over past issues on the repo, it seems like adding a dependency on head is something you're trying to avoid.
https://github.com/zimbatm/shab/blob/b33927943dae0b80bf56a0424571ba3a5f45b8e1/shab#L28=
Is the extra newline causing some issues for you, or is it more for correctness' sake?
Yeah, it's a shame but adding a dependency on head would go counter to the spirit of the project :)
I'm leaning towards letting go of the correctness for that specific case. Just to keep things simple and dependency-free. This should be documented though.