I press Ctrl+D to end standard input, but it only works if I'm on a fresh line. And that requires me to push Enter first, which puts an unwanted new line character in there. Is there any way around that?
Ctrl-D does not work only on a fresh line as you say. Take
rev for example, which reverses each input line.
Normally, you press Enter after input, and it reverses that line:
$ rev asdf fdsa
If you do not want to append a newline to your input, just press
Ctrl-D twice after you input
asdf, it will be reversed in the same line:
$ rev asdffdsa
Different programs handle this differently; for example
bc does not behave like above.